@lovable.dev/vite-tanstack-config 2.0.0 → 2.1.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 CHANGED
@@ -312,8 +312,19 @@ function defineConfig(configOrOptions = {}) {
312
312
  );
313
313
  }
314
314
  if (shouldRunNitro) {
315
+ let nitroMod;
315
316
  try {
316
- const { nitro } = await import("nitro/vite");
317
+ nitroMod = await import("nitro/vite");
318
+ } catch (err) {
319
+ if (explicitNitro || isSandbox) {
320
+ const reason = explicitNitro ? `an explicit \`nitro\` option (${options.nitro === true ? "true" : "{ ... }"}) was set in vite.config.ts` : "running inside a Lovable sandbox";
321
+ throw new Error(
322
+ `[@lovable.dev/vite-tanstack-config] ${reason}, but the \`nitro\` package isn't installed. Add \`nitro\` to your devDependencies (matches peerDependency >=3.0.260429-beta). Original import error: ${err instanceof Error ? err.message : String(err)}`
323
+ );
324
+ }
325
+ }
326
+ if (nitroMod) {
327
+ const { nitro } = nitroMod;
317
328
  const userNitroOpts = typeof options.nitro === "object" && options.nitro ? options.nitro : {};
318
329
  const preset = userNitroOpts.preset ?? process.env.NITRO_PRESET ?? "cloudflare-module";
319
330
  const output = {
@@ -322,8 +333,11 @@ function defineConfig(configOrOptions = {}) {
322
333
  publicDir: "dist/client",
323
334
  ...userNitroOpts.output
324
335
  };
325
- internalPlugins.push(nitro({ ...userNitroOpts, preset, output }));
326
- } catch {
336
+ const nitroOpts = { ...userNitroOpts, preset, output };
337
+ if (preset === "cloudflare-module") {
338
+ nitroOpts.cloudflare = { nodeCompat: true, deployConfig: true, ...userNitroOpts.cloudflare };
339
+ }
340
+ internalPlugins.push(nitro(nitroOpts));
327
341
  }
328
342
  }
329
343
  const viteReact = (await import("@vitejs/plugin-react")).default;
package/dist/index.d.cts CHANGED
@@ -31,6 +31,10 @@ interface LovableViteTanstackOptions {
31
31
  publicDir?: string;
32
32
  serverDir?: string;
33
33
  };
34
+ cloudflare?: {
35
+ nodeCompat?: boolean;
36
+ deployConfig?: boolean;
37
+ };
34
38
  } | false;
35
39
  /** Options forwarded to tanstackStart(). */
36
40
  tanstackStart?: Record<string, unknown>;
package/dist/index.d.ts CHANGED
@@ -31,6 +31,10 @@ interface LovableViteTanstackOptions {
31
31
  publicDir?: string;
32
32
  serverDir?: string;
33
33
  };
34
+ cloudflare?: {
35
+ nodeCompat?: boolean;
36
+ deployConfig?: boolean;
37
+ };
34
38
  } | false;
35
39
  /** Options forwarded to tanstackStart(). */
36
40
  tanstackStart?: Record<string, unknown>;
package/dist/index.js CHANGED
@@ -278,8 +278,19 @@ function defineConfig(configOrOptions = {}) {
278
278
  );
279
279
  }
280
280
  if (shouldRunNitro) {
281
+ let nitroMod;
281
282
  try {
282
- const { nitro } = await import("nitro/vite");
283
+ nitroMod = await import("nitro/vite");
284
+ } catch (err) {
285
+ if (explicitNitro || isSandbox) {
286
+ const reason = explicitNitro ? `an explicit \`nitro\` option (${options.nitro === true ? "true" : "{ ... }"}) was set in vite.config.ts` : "running inside a Lovable sandbox";
287
+ throw new Error(
288
+ `[@lovable.dev/vite-tanstack-config] ${reason}, but the \`nitro\` package isn't installed. Add \`nitro\` to your devDependencies (matches peerDependency >=3.0.260429-beta). Original import error: ${err instanceof Error ? err.message : String(err)}`
289
+ );
290
+ }
291
+ }
292
+ if (nitroMod) {
293
+ const { nitro } = nitroMod;
283
294
  const userNitroOpts = typeof options.nitro === "object" && options.nitro ? options.nitro : {};
284
295
  const preset = userNitroOpts.preset ?? process.env.NITRO_PRESET ?? "cloudflare-module";
285
296
  const output = {
@@ -288,8 +299,11 @@ function defineConfig(configOrOptions = {}) {
288
299
  publicDir: "dist/client",
289
300
  ...userNitroOpts.output
290
301
  };
291
- internalPlugins.push(nitro({ ...userNitroOpts, preset, output }));
292
- } catch {
302
+ const nitroOpts = { ...userNitroOpts, preset, output };
303
+ if (preset === "cloudflare-module") {
304
+ nitroOpts.cloudflare = { nodeCompat: true, deployConfig: true, ...userNitroOpts.cloudflare };
305
+ }
306
+ internalPlugins.push(nitro(nitroOpts));
293
307
  }
294
308
  }
295
309
  const viteReact = (await import("@vitejs/plugin-react")).default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lovable.dev/vite-tanstack-config",
3
- "version": "2.0.0",
3
+ "version": "2.1.1",
4
4
  "description": "Vite config wrapper for Lovable TanStack Start projects",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.js",