@lovable.dev/vite-tanstack-config 2.8.4 → 2.8.6

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
@@ -403,6 +403,42 @@ function lovableBuildErrorDiagnostics() {
403
403
  }
404
404
  };
405
405
  }
406
+ const NODEJS_COMPAT_DEFAULT_ON_DATE = "2026-08-04";
407
+ const SANDBOX_WRANGLER_CONFIG_PATH = "dist/server/wrangler.json";
408
+ function stripRedundantNodejsCompatFlag() {
409
+ let root = process.cwd();
410
+ return {
411
+ name: "lovable-strip-redundant-nodejs-compat",
412
+ apply: "build",
413
+ configResolved(config) {
414
+ root = config.root;
415
+ },
416
+ buildApp: {
417
+ order: "post",
418
+ handler: async () => {
419
+ const { readFile, writeFile } = await import("node:fs/promises");
420
+ const configPath = (await import("node:path")).join(root, SANDBOX_WRANGLER_CONFIG_PATH);
421
+ let parsed;
422
+ try {
423
+ parsed = JSON.parse(await readFile(configPath, "utf8"));
424
+ } catch {
425
+ return;
426
+ }
427
+ if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) return;
428
+ const config = parsed;
429
+ if (typeof config.compatibility_date !== "string") return;
430
+ if (config.compatibility_date < NODEJS_COMPAT_DEFAULT_ON_DATE) return;
431
+ if (!Array.isArray(config.compatibility_flags)) return;
432
+ const flags = config.compatibility_flags.filter((flag) => flag !== "nodejs_compat");
433
+ if (flags.length === config.compatibility_flags.length) return;
434
+ await writeFile(configPath, JSON.stringify({
435
+ ...config,
436
+ compatibility_flags: flags
437
+ }, null, 2));
438
+ }
439
+ }
440
+ };
441
+ }
406
442
  function devSsrErrorLogger() {
407
443
  let lastCapture;
408
444
  const CAPTURE_TTL_MS = 5e3;
@@ -616,6 +652,7 @@ function defineConfig(configOrOptions = {}) {
616
652
  };
617
653
  } else if (!nitroOpts.preset && !await nitroSupportsDefaultPreset()) logWarning("The installed `nitro` predates the `defaultPreset` option (3.0.260603-beta), so the Cloudflare fallback is ignored and a zero-config build may target Node instead. Upgrade nitro to >=3.0.260603-beta, or set an explicit `nitro: { preset: \"cloudflare-module\" }`.");
618
654
  internalPlugins.push(nitro(nitroOpts));
655
+ if (isSandbox) internalPlugins.push(stripRedundantNodejsCompatFlag());
619
656
  }
620
657
  }
621
658
  const viteReact = (await import("@vitejs/plugin-react")).default;
@@ -694,3 +731,4 @@ function defineConfig(configOrOptions = {}) {
694
731
  //#endregion
695
732
  exports.defineConfig = defineConfig;
696
733
  exports.lovableAssetsProxyPlugin = lovableAssetsProxyPlugin;
734
+ exports.stripRedundantNodejsCompatFlag = stripRedundantNodejsCompatFlag;
package/dist/index.d.cts CHANGED
@@ -12,6 +12,7 @@ import { ConfigEnv, Plugin, PluginOption, UserConfig, UserConfigFn, UserConfigFn
12
12
  declare function lovableAssetsProxyPlugin(): Plugin;
13
13
  //#endregion
14
14
  //#region src/index.d.ts
15
+ declare function stripRedundantNodejsCompatFlag(): Plugin;
15
16
  interface LovableViteTanstackOptions {
16
17
  plugins?: PluginOption[];
17
18
  vite?: UserConfig;
@@ -71,4 +72,4 @@ declare function defineConfig(config: UserConfigFnPromise): (env: ConfigEnv) =>
71
72
  declare function defineConfig(config: UserConfigFn): (env: ConfigEnv) => Promise<UserConfig>;
72
73
  declare function defineConfig(options?: LovableViteTanstackOptions): (env: ConfigEnv) => Promise<UserConfig>;
73
74
  //#endregion
74
- export { LovableViteTanstackOptions, defineConfig, lovableAssetsProxyPlugin };
75
+ export { LovableViteTanstackOptions, defineConfig, lovableAssetsProxyPlugin, stripRedundantNodejsCompatFlag };
package/dist/index.d.ts CHANGED
@@ -12,6 +12,7 @@ import { ConfigEnv, Plugin, PluginOption, UserConfig, UserConfigFn, UserConfigFn
12
12
  declare function lovableAssetsProxyPlugin(): Plugin;
13
13
  //#endregion
14
14
  //#region src/index.d.ts
15
+ declare function stripRedundantNodejsCompatFlag(): Plugin;
15
16
  interface LovableViteTanstackOptions {
16
17
  plugins?: PluginOption[];
17
18
  vite?: UserConfig;
@@ -71,4 +72,4 @@ declare function defineConfig(config: UserConfigFnPromise): (env: ConfigEnv) =>
71
72
  declare function defineConfig(config: UserConfigFn): (env: ConfigEnv) => Promise<UserConfig>;
72
73
  declare function defineConfig(options?: LovableViteTanstackOptions): (env: ConfigEnv) => Promise<UserConfig>;
73
74
  //#endregion
74
- export { LovableViteTanstackOptions, defineConfig, lovableAssetsProxyPlugin };
75
+ export { LovableViteTanstackOptions, defineConfig, lovableAssetsProxyPlugin, stripRedundantNodejsCompatFlag };
package/dist/index.js CHANGED
@@ -379,6 +379,42 @@ function lovableBuildErrorDiagnostics() {
379
379
  }
380
380
  };
381
381
  }
382
+ const NODEJS_COMPAT_DEFAULT_ON_DATE = "2026-08-04";
383
+ const SANDBOX_WRANGLER_CONFIG_PATH = "dist/server/wrangler.json";
384
+ function stripRedundantNodejsCompatFlag() {
385
+ let root = process.cwd();
386
+ return {
387
+ name: "lovable-strip-redundant-nodejs-compat",
388
+ apply: "build",
389
+ configResolved(config) {
390
+ root = config.root;
391
+ },
392
+ buildApp: {
393
+ order: "post",
394
+ handler: async () => {
395
+ const { readFile, writeFile } = await import("node:fs/promises");
396
+ const configPath = (await import("node:path")).join(root, SANDBOX_WRANGLER_CONFIG_PATH);
397
+ let parsed;
398
+ try {
399
+ parsed = JSON.parse(await readFile(configPath, "utf8"));
400
+ } catch {
401
+ return;
402
+ }
403
+ if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) return;
404
+ const config = parsed;
405
+ if (typeof config.compatibility_date !== "string") return;
406
+ if (config.compatibility_date < NODEJS_COMPAT_DEFAULT_ON_DATE) return;
407
+ if (!Array.isArray(config.compatibility_flags)) return;
408
+ const flags = config.compatibility_flags.filter((flag) => flag !== "nodejs_compat");
409
+ if (flags.length === config.compatibility_flags.length) return;
410
+ await writeFile(configPath, JSON.stringify({
411
+ ...config,
412
+ compatibility_flags: flags
413
+ }, null, 2));
414
+ }
415
+ }
416
+ };
417
+ }
382
418
  function devSsrErrorLogger() {
383
419
  let lastCapture;
384
420
  const CAPTURE_TTL_MS = 5e3;
@@ -592,6 +628,7 @@ function defineConfig(configOrOptions = {}) {
592
628
  };
593
629
  } else if (!nitroOpts.preset && !await nitroSupportsDefaultPreset()) logWarning("The installed `nitro` predates the `defaultPreset` option (3.0.260603-beta), so the Cloudflare fallback is ignored and a zero-config build may target Node instead. Upgrade nitro to >=3.0.260603-beta, or set an explicit `nitro: { preset: \"cloudflare-module\" }`.");
594
630
  internalPlugins.push(nitro(nitroOpts));
631
+ if (isSandbox) internalPlugins.push(stripRedundantNodejsCompatFlag());
595
632
  }
596
633
  }
597
634
  const viteReact = (await import("@vitejs/plugin-react")).default;
@@ -668,4 +705,4 @@ function defineConfig(configOrOptions = {}) {
668
705
  };
669
706
  }
670
707
  //#endregion
671
- export { defineConfig, lovableAssetsProxyPlugin };
708
+ export { defineConfig, lovableAssetsProxyPlugin, stripRedundantNodejsCompatFlag };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lovable.dev/vite-tanstack-config",
3
- "version": "2.8.4",
3
+ "version": "2.8.6",
4
4
  "description": "Vite config wrapper for Lovable TanStack Start projects",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.js",
@@ -18,7 +18,7 @@
18
18
  "license": "MIT",
19
19
  "dependencies": {
20
20
  "@lovable.dev/vite-plugin-dev-server-bridge": "^1.2.1",
21
- "@lovable.dev/vite-plugin-hmr-gate": "^1.3.3",
21
+ "@lovable.dev/vite-plugin-hmr-gate": "^1.3.4",
22
22
  "@tanstack/devtools-vite": "^0.8.1",
23
23
  "lightningcss": "^1.30.0"
24
24
  },