@lovable.dev/vite-tanstack-config 2.6.0 → 2.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +196 -0
- package/dist/index.js +196 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -175,6 +175,199 @@ function isBuildError(error) {
|
|
|
175
175
|
const message = typeof e.message === "string" ? e.message : "";
|
|
176
176
|
return BUILD_ERROR_MESSAGE.test(message);
|
|
177
177
|
}
|
|
178
|
+
var BUILD_DIAGNOSTICS_PLUGIN_NAME = "lovable-build-error-diagnostics";
|
|
179
|
+
var MAX_DIAGNOSTIC_JSON_LENGTH = 6e3;
|
|
180
|
+
var MAX_DIAGNOSTIC_STRING_LENGTH = 2e3;
|
|
181
|
+
var MAX_DIAGNOSTIC_NESTED_ERRORS = 20;
|
|
182
|
+
var MAX_DIAGNOSTIC_DEPTH = 4;
|
|
183
|
+
var COMPACT_DIAGNOSTIC_STRING_LENGTH = 300;
|
|
184
|
+
var COMPACT_DIAGNOSTIC_NESTED_ERRORS = 3;
|
|
185
|
+
var COMPACT_DIAGNOSTIC_DEPTH = 3;
|
|
186
|
+
var DIAGNOSTIC_ERROR_FIELDS = [
|
|
187
|
+
"name",
|
|
188
|
+
"message",
|
|
189
|
+
"plugin",
|
|
190
|
+
"pluginCode",
|
|
191
|
+
"id",
|
|
192
|
+
"moduleId",
|
|
193
|
+
"hook",
|
|
194
|
+
"code",
|
|
195
|
+
"loc",
|
|
196
|
+
"frame",
|
|
197
|
+
"stack",
|
|
198
|
+
"cause"
|
|
199
|
+
];
|
|
200
|
+
function truncateDiagnosticString(value) {
|
|
201
|
+
return truncateDiagnosticStringTo(value, MAX_DIAGNOSTIC_STRING_LENGTH);
|
|
202
|
+
}
|
|
203
|
+
function truncateDiagnosticStringTo(value, maxLength) {
|
|
204
|
+
return value.length > maxLength ? `${value.slice(0, maxLength)}...[truncated]` : value;
|
|
205
|
+
}
|
|
206
|
+
function readDiagnosticProperty(value, key) {
|
|
207
|
+
try {
|
|
208
|
+
return value[key];
|
|
209
|
+
} catch (error) {
|
|
210
|
+
return `[unreadable: ${error instanceof Error ? error.message : String(error)}]`;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
function serializeOwnDiagnosticProperties(value, depth, seen) {
|
|
214
|
+
const keys = Object.keys(value);
|
|
215
|
+
const output = {};
|
|
216
|
+
for (const key of keys.slice(0, MAX_DIAGNOSTIC_NESTED_ERRORS)) {
|
|
217
|
+
const nested = readDiagnosticProperty(value, key);
|
|
218
|
+
if (nested == null || nested === "")
|
|
219
|
+
continue;
|
|
220
|
+
output[key] = serializeDiagnosticValue(nested, depth + 1, seen);
|
|
221
|
+
}
|
|
222
|
+
if (keys.length > MAX_DIAGNOSTIC_NESTED_ERRORS) {
|
|
223
|
+
output.properties_truncated = keys.length - MAX_DIAGNOSTIC_NESTED_ERRORS;
|
|
224
|
+
}
|
|
225
|
+
return output;
|
|
226
|
+
}
|
|
227
|
+
function describeDiagnosticPrimitive(value) {
|
|
228
|
+
if (typeof value === "symbol")
|
|
229
|
+
return value.description ? `Symbol(${value.description})` : "Symbol()";
|
|
230
|
+
if (typeof value === "bigint")
|
|
231
|
+
return value.toString();
|
|
232
|
+
if (typeof value === "function")
|
|
233
|
+
return `[function ${value.name || "anonymous"}]`;
|
|
234
|
+
return String(value);
|
|
235
|
+
}
|
|
236
|
+
function describeDiagnosticObject(value) {
|
|
237
|
+
const constructorName = value.constructor?.name;
|
|
238
|
+
if (typeof constructorName === "string" && constructorName !== "" && constructorName !== "Object") {
|
|
239
|
+
return `[${constructorName}]`;
|
|
240
|
+
}
|
|
241
|
+
return Object.prototype.toString.call(value);
|
|
242
|
+
}
|
|
243
|
+
function serializeDiagnosticValue(value, depth, seen) {
|
|
244
|
+
if (value == null)
|
|
245
|
+
return value;
|
|
246
|
+
if (typeof value === "string")
|
|
247
|
+
return truncateDiagnosticString(value);
|
|
248
|
+
if (typeof value === "number" || typeof value === "boolean")
|
|
249
|
+
return value;
|
|
250
|
+
if (typeof value !== "object")
|
|
251
|
+
return describeDiagnosticPrimitive(value);
|
|
252
|
+
if (seen.has(value))
|
|
253
|
+
return "[circular]";
|
|
254
|
+
if (depth >= MAX_DIAGNOSTIC_DEPTH)
|
|
255
|
+
return "[max depth]";
|
|
256
|
+
seen.add(value);
|
|
257
|
+
try {
|
|
258
|
+
if (Array.isArray(value)) {
|
|
259
|
+
return value.slice(0, MAX_DIAGNOSTIC_NESTED_ERRORS).map((item) => serializeDiagnosticValue(item, depth + 1, seen));
|
|
260
|
+
}
|
|
261
|
+
const record = value;
|
|
262
|
+
const output = {};
|
|
263
|
+
for (const field of DIAGNOSTIC_ERROR_FIELDS) {
|
|
264
|
+
if (!(field in record))
|
|
265
|
+
continue;
|
|
266
|
+
const nested = readDiagnosticProperty(record, field);
|
|
267
|
+
if (nested == null || nested === "")
|
|
268
|
+
continue;
|
|
269
|
+
output[field] = serializeDiagnosticValue(nested, depth + 1, seen);
|
|
270
|
+
}
|
|
271
|
+
const nestedErrors = readDiagnosticProperty(record, "errors");
|
|
272
|
+
if (Array.isArray(nestedErrors)) {
|
|
273
|
+
output.errors = nestedErrors.slice(0, MAX_DIAGNOSTIC_NESTED_ERRORS).map((item) => serializeDiagnosticValue(item, depth + 1, seen));
|
|
274
|
+
if (nestedErrors.length > MAX_DIAGNOSTIC_NESTED_ERRORS) {
|
|
275
|
+
output.errors_truncated = nestedErrors.length - MAX_DIAGNOSTIC_NESTED_ERRORS;
|
|
276
|
+
}
|
|
277
|
+
} else if (nestedErrors != null && nestedErrors !== "") {
|
|
278
|
+
output.errors = serializeDiagnosticValue(nestedErrors, depth + 1, seen);
|
|
279
|
+
}
|
|
280
|
+
if (Object.keys(output).length > 0)
|
|
281
|
+
return output;
|
|
282
|
+
const ownProperties = serializeOwnDiagnosticProperties(record, depth, seen);
|
|
283
|
+
return Object.keys(ownProperties).length > 0 ? ownProperties : describeDiagnosticObject(value);
|
|
284
|
+
} catch (error) {
|
|
285
|
+
return `[unreadable object: ${error instanceof Error ? error.message : String(error)}]`;
|
|
286
|
+
} finally {
|
|
287
|
+
seen.delete(value);
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
function compactDiagnosticValue(value, depth) {
|
|
291
|
+
if (value == null)
|
|
292
|
+
return value;
|
|
293
|
+
if (typeof value === "string")
|
|
294
|
+
return truncateDiagnosticStringTo(value, COMPACT_DIAGNOSTIC_STRING_LENGTH);
|
|
295
|
+
if (typeof value === "number" || typeof value === "boolean")
|
|
296
|
+
return value;
|
|
297
|
+
if (typeof value !== "object")
|
|
298
|
+
return describeDiagnosticPrimitive(value);
|
|
299
|
+
if (depth >= COMPACT_DIAGNOSTIC_DEPTH)
|
|
300
|
+
return "[max depth]";
|
|
301
|
+
try {
|
|
302
|
+
if (Array.isArray(value)) {
|
|
303
|
+
const items = value.slice(0, COMPACT_DIAGNOSTIC_NESTED_ERRORS).map((item) => compactDiagnosticValue(item, depth + 1));
|
|
304
|
+
if (value.length > COMPACT_DIAGNOSTIC_NESTED_ERRORS) {
|
|
305
|
+
items.push(`[${value.length - COMPACT_DIAGNOSTIC_NESTED_ERRORS} items truncated]`);
|
|
306
|
+
}
|
|
307
|
+
return items;
|
|
308
|
+
}
|
|
309
|
+
const record = value;
|
|
310
|
+
const output = {};
|
|
311
|
+
const keys = Object.keys(record);
|
|
312
|
+
for (const key of keys.slice(0, MAX_DIAGNOSTIC_NESTED_ERRORS)) {
|
|
313
|
+
const nested = readDiagnosticProperty(record, key);
|
|
314
|
+
if (nested == null || nested === "")
|
|
315
|
+
continue;
|
|
316
|
+
output[key] = compactDiagnosticValue(nested, depth + 1);
|
|
317
|
+
}
|
|
318
|
+
if (keys.length > MAX_DIAGNOSTIC_NESTED_ERRORS) {
|
|
319
|
+
output.properties_truncated = keys.length - MAX_DIAGNOSTIC_NESTED_ERRORS;
|
|
320
|
+
}
|
|
321
|
+
return output;
|
|
322
|
+
} catch (error) {
|
|
323
|
+
return `[unreadable object: ${error instanceof Error ? error.message : String(error)}]`;
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
function stringifyDiagnosticPayload(diagnostics) {
|
|
327
|
+
const full = JSON.stringify(diagnostics);
|
|
328
|
+
if (full && full.length <= MAX_DIAGNOSTIC_JSON_LENGTH)
|
|
329
|
+
return full;
|
|
330
|
+
const compact = compactDiagnosticValue(diagnostics, 0);
|
|
331
|
+
const compactPayload = compact != null && typeof compact === "object" && !Array.isArray(compact) ? { ...compact, diagnostics_truncated: true } : { diagnostics_truncated: true, value: compact };
|
|
332
|
+
const compactJson = JSON.stringify(compactPayload);
|
|
333
|
+
if (compactJson.length <= MAX_DIAGNOSTIC_JSON_LENGTH)
|
|
334
|
+
return compactJson;
|
|
335
|
+
return JSON.stringify({
|
|
336
|
+
diagnostics_truncated: true,
|
|
337
|
+
message: "Diagnostic payload exceeded output budget."
|
|
338
|
+
});
|
|
339
|
+
}
|
|
340
|
+
function lovableBuildErrorDiagnostics() {
|
|
341
|
+
return {
|
|
342
|
+
name: BUILD_DIAGNOSTICS_PLUGIN_NAME,
|
|
343
|
+
apply: "build",
|
|
344
|
+
buildEnd(error) {
|
|
345
|
+
if (!error)
|
|
346
|
+
return;
|
|
347
|
+
try {
|
|
348
|
+
const diagnostics = serializeDiagnosticValue(error, 0, /* @__PURE__ */ new WeakSet());
|
|
349
|
+
const output = `
|
|
350
|
+
[lovable-build-error-diagnostics]
|
|
351
|
+
${stringifyDiagnosticPayload(diagnostics)}
|
|
352
|
+
[/lovable-build-error-diagnostics]
|
|
353
|
+
`;
|
|
354
|
+
let written = false;
|
|
355
|
+
const write = () => {
|
|
356
|
+
if (written)
|
|
357
|
+
return;
|
|
358
|
+
written = true;
|
|
359
|
+
try {
|
|
360
|
+
process.stderr.write(output);
|
|
361
|
+
} catch {
|
|
362
|
+
}
|
|
363
|
+
};
|
|
364
|
+
setImmediate(write);
|
|
365
|
+
process.once("exit", write);
|
|
366
|
+
} catch {
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
};
|
|
370
|
+
}
|
|
178
371
|
function devSsrErrorLogger() {
|
|
179
372
|
let lastCapture;
|
|
180
373
|
const CAPTURE_TTL_MS = 5e3;
|
|
@@ -373,6 +566,9 @@ function defineConfig(configOrOptions = {}) {
|
|
|
373
566
|
if (options.ssrErrorLogger !== false) {
|
|
374
567
|
internalPlugins.push(devSsrErrorLogger());
|
|
375
568
|
}
|
|
569
|
+
if (command === "build" && isSandbox) {
|
|
570
|
+
internalPlugins.push(lovableBuildErrorDiagnostics());
|
|
571
|
+
}
|
|
376
572
|
const { tanstackStart } = await import("@tanstack/react-start/plugin/vite");
|
|
377
573
|
const tanstackStartDefaults = {
|
|
378
574
|
importProtection: {
|
package/dist/index.js
CHANGED
|
@@ -141,6 +141,199 @@ function isBuildError(error) {
|
|
|
141
141
|
const message = typeof e.message === "string" ? e.message : "";
|
|
142
142
|
return BUILD_ERROR_MESSAGE.test(message);
|
|
143
143
|
}
|
|
144
|
+
var BUILD_DIAGNOSTICS_PLUGIN_NAME = "lovable-build-error-diagnostics";
|
|
145
|
+
var MAX_DIAGNOSTIC_JSON_LENGTH = 6e3;
|
|
146
|
+
var MAX_DIAGNOSTIC_STRING_LENGTH = 2e3;
|
|
147
|
+
var MAX_DIAGNOSTIC_NESTED_ERRORS = 20;
|
|
148
|
+
var MAX_DIAGNOSTIC_DEPTH = 4;
|
|
149
|
+
var COMPACT_DIAGNOSTIC_STRING_LENGTH = 300;
|
|
150
|
+
var COMPACT_DIAGNOSTIC_NESTED_ERRORS = 3;
|
|
151
|
+
var COMPACT_DIAGNOSTIC_DEPTH = 3;
|
|
152
|
+
var DIAGNOSTIC_ERROR_FIELDS = [
|
|
153
|
+
"name",
|
|
154
|
+
"message",
|
|
155
|
+
"plugin",
|
|
156
|
+
"pluginCode",
|
|
157
|
+
"id",
|
|
158
|
+
"moduleId",
|
|
159
|
+
"hook",
|
|
160
|
+
"code",
|
|
161
|
+
"loc",
|
|
162
|
+
"frame",
|
|
163
|
+
"stack",
|
|
164
|
+
"cause"
|
|
165
|
+
];
|
|
166
|
+
function truncateDiagnosticString(value) {
|
|
167
|
+
return truncateDiagnosticStringTo(value, MAX_DIAGNOSTIC_STRING_LENGTH);
|
|
168
|
+
}
|
|
169
|
+
function truncateDiagnosticStringTo(value, maxLength) {
|
|
170
|
+
return value.length > maxLength ? `${value.slice(0, maxLength)}...[truncated]` : value;
|
|
171
|
+
}
|
|
172
|
+
function readDiagnosticProperty(value, key) {
|
|
173
|
+
try {
|
|
174
|
+
return value[key];
|
|
175
|
+
} catch (error) {
|
|
176
|
+
return `[unreadable: ${error instanceof Error ? error.message : String(error)}]`;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
function serializeOwnDiagnosticProperties(value, depth, seen) {
|
|
180
|
+
const keys = Object.keys(value);
|
|
181
|
+
const output = {};
|
|
182
|
+
for (const key of keys.slice(0, MAX_DIAGNOSTIC_NESTED_ERRORS)) {
|
|
183
|
+
const nested = readDiagnosticProperty(value, key);
|
|
184
|
+
if (nested == null || nested === "")
|
|
185
|
+
continue;
|
|
186
|
+
output[key] = serializeDiagnosticValue(nested, depth + 1, seen);
|
|
187
|
+
}
|
|
188
|
+
if (keys.length > MAX_DIAGNOSTIC_NESTED_ERRORS) {
|
|
189
|
+
output.properties_truncated = keys.length - MAX_DIAGNOSTIC_NESTED_ERRORS;
|
|
190
|
+
}
|
|
191
|
+
return output;
|
|
192
|
+
}
|
|
193
|
+
function describeDiagnosticPrimitive(value) {
|
|
194
|
+
if (typeof value === "symbol")
|
|
195
|
+
return value.description ? `Symbol(${value.description})` : "Symbol()";
|
|
196
|
+
if (typeof value === "bigint")
|
|
197
|
+
return value.toString();
|
|
198
|
+
if (typeof value === "function")
|
|
199
|
+
return `[function ${value.name || "anonymous"}]`;
|
|
200
|
+
return String(value);
|
|
201
|
+
}
|
|
202
|
+
function describeDiagnosticObject(value) {
|
|
203
|
+
const constructorName = value.constructor?.name;
|
|
204
|
+
if (typeof constructorName === "string" && constructorName !== "" && constructorName !== "Object") {
|
|
205
|
+
return `[${constructorName}]`;
|
|
206
|
+
}
|
|
207
|
+
return Object.prototype.toString.call(value);
|
|
208
|
+
}
|
|
209
|
+
function serializeDiagnosticValue(value, depth, seen) {
|
|
210
|
+
if (value == null)
|
|
211
|
+
return value;
|
|
212
|
+
if (typeof value === "string")
|
|
213
|
+
return truncateDiagnosticString(value);
|
|
214
|
+
if (typeof value === "number" || typeof value === "boolean")
|
|
215
|
+
return value;
|
|
216
|
+
if (typeof value !== "object")
|
|
217
|
+
return describeDiagnosticPrimitive(value);
|
|
218
|
+
if (seen.has(value))
|
|
219
|
+
return "[circular]";
|
|
220
|
+
if (depth >= MAX_DIAGNOSTIC_DEPTH)
|
|
221
|
+
return "[max depth]";
|
|
222
|
+
seen.add(value);
|
|
223
|
+
try {
|
|
224
|
+
if (Array.isArray(value)) {
|
|
225
|
+
return value.slice(0, MAX_DIAGNOSTIC_NESTED_ERRORS).map((item) => serializeDiagnosticValue(item, depth + 1, seen));
|
|
226
|
+
}
|
|
227
|
+
const record = value;
|
|
228
|
+
const output = {};
|
|
229
|
+
for (const field of DIAGNOSTIC_ERROR_FIELDS) {
|
|
230
|
+
if (!(field in record))
|
|
231
|
+
continue;
|
|
232
|
+
const nested = readDiagnosticProperty(record, field);
|
|
233
|
+
if (nested == null || nested === "")
|
|
234
|
+
continue;
|
|
235
|
+
output[field] = serializeDiagnosticValue(nested, depth + 1, seen);
|
|
236
|
+
}
|
|
237
|
+
const nestedErrors = readDiagnosticProperty(record, "errors");
|
|
238
|
+
if (Array.isArray(nestedErrors)) {
|
|
239
|
+
output.errors = nestedErrors.slice(0, MAX_DIAGNOSTIC_NESTED_ERRORS).map((item) => serializeDiagnosticValue(item, depth + 1, seen));
|
|
240
|
+
if (nestedErrors.length > MAX_DIAGNOSTIC_NESTED_ERRORS) {
|
|
241
|
+
output.errors_truncated = nestedErrors.length - MAX_DIAGNOSTIC_NESTED_ERRORS;
|
|
242
|
+
}
|
|
243
|
+
} else if (nestedErrors != null && nestedErrors !== "") {
|
|
244
|
+
output.errors = serializeDiagnosticValue(nestedErrors, depth + 1, seen);
|
|
245
|
+
}
|
|
246
|
+
if (Object.keys(output).length > 0)
|
|
247
|
+
return output;
|
|
248
|
+
const ownProperties = serializeOwnDiagnosticProperties(record, depth, seen);
|
|
249
|
+
return Object.keys(ownProperties).length > 0 ? ownProperties : describeDiagnosticObject(value);
|
|
250
|
+
} catch (error) {
|
|
251
|
+
return `[unreadable object: ${error instanceof Error ? error.message : String(error)}]`;
|
|
252
|
+
} finally {
|
|
253
|
+
seen.delete(value);
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
function compactDiagnosticValue(value, depth) {
|
|
257
|
+
if (value == null)
|
|
258
|
+
return value;
|
|
259
|
+
if (typeof value === "string")
|
|
260
|
+
return truncateDiagnosticStringTo(value, COMPACT_DIAGNOSTIC_STRING_LENGTH);
|
|
261
|
+
if (typeof value === "number" || typeof value === "boolean")
|
|
262
|
+
return value;
|
|
263
|
+
if (typeof value !== "object")
|
|
264
|
+
return describeDiagnosticPrimitive(value);
|
|
265
|
+
if (depth >= COMPACT_DIAGNOSTIC_DEPTH)
|
|
266
|
+
return "[max depth]";
|
|
267
|
+
try {
|
|
268
|
+
if (Array.isArray(value)) {
|
|
269
|
+
const items = value.slice(0, COMPACT_DIAGNOSTIC_NESTED_ERRORS).map((item) => compactDiagnosticValue(item, depth + 1));
|
|
270
|
+
if (value.length > COMPACT_DIAGNOSTIC_NESTED_ERRORS) {
|
|
271
|
+
items.push(`[${value.length - COMPACT_DIAGNOSTIC_NESTED_ERRORS} items truncated]`);
|
|
272
|
+
}
|
|
273
|
+
return items;
|
|
274
|
+
}
|
|
275
|
+
const record = value;
|
|
276
|
+
const output = {};
|
|
277
|
+
const keys = Object.keys(record);
|
|
278
|
+
for (const key of keys.slice(0, MAX_DIAGNOSTIC_NESTED_ERRORS)) {
|
|
279
|
+
const nested = readDiagnosticProperty(record, key);
|
|
280
|
+
if (nested == null || nested === "")
|
|
281
|
+
continue;
|
|
282
|
+
output[key] = compactDiagnosticValue(nested, depth + 1);
|
|
283
|
+
}
|
|
284
|
+
if (keys.length > MAX_DIAGNOSTIC_NESTED_ERRORS) {
|
|
285
|
+
output.properties_truncated = keys.length - MAX_DIAGNOSTIC_NESTED_ERRORS;
|
|
286
|
+
}
|
|
287
|
+
return output;
|
|
288
|
+
} catch (error) {
|
|
289
|
+
return `[unreadable object: ${error instanceof Error ? error.message : String(error)}]`;
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
function stringifyDiagnosticPayload(diagnostics) {
|
|
293
|
+
const full = JSON.stringify(diagnostics);
|
|
294
|
+
if (full && full.length <= MAX_DIAGNOSTIC_JSON_LENGTH)
|
|
295
|
+
return full;
|
|
296
|
+
const compact = compactDiagnosticValue(diagnostics, 0);
|
|
297
|
+
const compactPayload = compact != null && typeof compact === "object" && !Array.isArray(compact) ? { ...compact, diagnostics_truncated: true } : { diagnostics_truncated: true, value: compact };
|
|
298
|
+
const compactJson = JSON.stringify(compactPayload);
|
|
299
|
+
if (compactJson.length <= MAX_DIAGNOSTIC_JSON_LENGTH)
|
|
300
|
+
return compactJson;
|
|
301
|
+
return JSON.stringify({
|
|
302
|
+
diagnostics_truncated: true,
|
|
303
|
+
message: "Diagnostic payload exceeded output budget."
|
|
304
|
+
});
|
|
305
|
+
}
|
|
306
|
+
function lovableBuildErrorDiagnostics() {
|
|
307
|
+
return {
|
|
308
|
+
name: BUILD_DIAGNOSTICS_PLUGIN_NAME,
|
|
309
|
+
apply: "build",
|
|
310
|
+
buildEnd(error) {
|
|
311
|
+
if (!error)
|
|
312
|
+
return;
|
|
313
|
+
try {
|
|
314
|
+
const diagnostics = serializeDiagnosticValue(error, 0, /* @__PURE__ */ new WeakSet());
|
|
315
|
+
const output = `
|
|
316
|
+
[lovable-build-error-diagnostics]
|
|
317
|
+
${stringifyDiagnosticPayload(diagnostics)}
|
|
318
|
+
[/lovable-build-error-diagnostics]
|
|
319
|
+
`;
|
|
320
|
+
let written = false;
|
|
321
|
+
const write = () => {
|
|
322
|
+
if (written)
|
|
323
|
+
return;
|
|
324
|
+
written = true;
|
|
325
|
+
try {
|
|
326
|
+
process.stderr.write(output);
|
|
327
|
+
} catch {
|
|
328
|
+
}
|
|
329
|
+
};
|
|
330
|
+
setImmediate(write);
|
|
331
|
+
process.once("exit", write);
|
|
332
|
+
} catch {
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
};
|
|
336
|
+
}
|
|
144
337
|
function devSsrErrorLogger() {
|
|
145
338
|
let lastCapture;
|
|
146
339
|
const CAPTURE_TTL_MS = 5e3;
|
|
@@ -339,6 +532,9 @@ function defineConfig(configOrOptions = {}) {
|
|
|
339
532
|
if (options.ssrErrorLogger !== false) {
|
|
340
533
|
internalPlugins.push(devSsrErrorLogger());
|
|
341
534
|
}
|
|
535
|
+
if (command === "build" && isSandbox) {
|
|
536
|
+
internalPlugins.push(lovableBuildErrorDiagnostics());
|
|
537
|
+
}
|
|
342
538
|
const { tanstackStart } = await import("@tanstack/react-start/plugin/vite");
|
|
343
539
|
const tanstackStartDefaults = {
|
|
344
540
|
importProtection: {
|