@lovable.dev/vite-tanstack-config 2.7.7 → 2.8.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 +27 -0
- package/dist/index.js +27 -0
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -100,6 +100,28 @@ function lovableAssetsProxyPlugin() {
|
|
|
100
100
|
};
|
|
101
101
|
}
|
|
102
102
|
//#endregion
|
|
103
|
+
//#region src/bundledDev.ts
|
|
104
|
+
const BUNDLED_DEV_ENV_VAR = "LOVABLE_FEATURE_BUNDLED_DEV";
|
|
105
|
+
function bundledDevRequested() {
|
|
106
|
+
return process.env[BUNDLED_DEV_ENV_VAR] === "true";
|
|
107
|
+
}
|
|
108
|
+
function viteVersionSupportsBundledDev(version) {
|
|
109
|
+
if (!version || version.includes("-")) return false;
|
|
110
|
+
const match = /^(\d+)\.(\d+)\.(\d+)$/.exec(version);
|
|
111
|
+
if (!match) return false;
|
|
112
|
+
const [major, minor] = [Number(match[1]), Number(match[2])];
|
|
113
|
+
return major > 8 || major === 8 && minor >= 1;
|
|
114
|
+
}
|
|
115
|
+
async function resolveInstalledViteVersion() {
|
|
116
|
+
try {
|
|
117
|
+
const { createRequire } = await import("node:module");
|
|
118
|
+
const { version } = createRequire(`${process.cwd()}/package.json`)("vite/package.json");
|
|
119
|
+
return typeof version === "string" ? version : void 0;
|
|
120
|
+
} catch {
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
//#endregion
|
|
103
125
|
//#region src/index.ts
|
|
104
126
|
const SANDBOX_ENV_VAR = "DEV_SERVER__PROJECT_PATH";
|
|
105
127
|
const LOVABLE_SANDBOX_ENV_VAR = "LOVABLE_SANDBOX";
|
|
@@ -647,6 +669,11 @@ function defineConfig(configOrOptions = {}) {
|
|
|
647
669
|
plugins: [...internalPlugins, ...options.plugins ?? []]
|
|
648
670
|
};
|
|
649
671
|
if (options.vite) config = (0, vite.mergeConfig)(config, options.vite);
|
|
672
|
+
if (command === "serve" && isSandbox && bundledDevRequested()) {
|
|
673
|
+
const viteVersion = await resolveInstalledViteVersion();
|
|
674
|
+
if (viteVersionSupportsBundledDev(viteVersion)) config = (0, vite.mergeConfig)(config, { experimental: { bundledDev: true } });
|
|
675
|
+
else logWarning(`Bundled dev requested (${BUNDLED_DEV_ENV_VAR}) but the installed vite (${viteVersion ?? "unresolved"}) is missing, prerelease, or below 8.1 — starting classic dev.`);
|
|
676
|
+
}
|
|
650
677
|
if (isSandbox) {
|
|
651
678
|
validateConfig(config);
|
|
652
679
|
config = cleanServerConfig((0, vite.mergeConfig)(config, { server: {
|
package/dist/index.js
CHANGED
|
@@ -76,6 +76,28 @@ function lovableAssetsProxyPlugin() {
|
|
|
76
76
|
};
|
|
77
77
|
}
|
|
78
78
|
//#endregion
|
|
79
|
+
//#region src/bundledDev.ts
|
|
80
|
+
const BUNDLED_DEV_ENV_VAR = "LOVABLE_FEATURE_BUNDLED_DEV";
|
|
81
|
+
function bundledDevRequested() {
|
|
82
|
+
return process.env[BUNDLED_DEV_ENV_VAR] === "true";
|
|
83
|
+
}
|
|
84
|
+
function viteVersionSupportsBundledDev(version) {
|
|
85
|
+
if (!version || version.includes("-")) return false;
|
|
86
|
+
const match = /^(\d+)\.(\d+)\.(\d+)$/.exec(version);
|
|
87
|
+
if (!match) return false;
|
|
88
|
+
const [major, minor] = [Number(match[1]), Number(match[2])];
|
|
89
|
+
return major > 8 || major === 8 && minor >= 1;
|
|
90
|
+
}
|
|
91
|
+
async function resolveInstalledViteVersion() {
|
|
92
|
+
try {
|
|
93
|
+
const { createRequire } = await import("node:module");
|
|
94
|
+
const { version } = createRequire(`${process.cwd()}/package.json`)("vite/package.json");
|
|
95
|
+
return typeof version === "string" ? version : void 0;
|
|
96
|
+
} catch {
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
//#endregion
|
|
79
101
|
//#region src/index.ts
|
|
80
102
|
const SANDBOX_ENV_VAR = "DEV_SERVER__PROJECT_PATH";
|
|
81
103
|
const LOVABLE_SANDBOX_ENV_VAR = "LOVABLE_SANDBOX";
|
|
@@ -623,6 +645,11 @@ function defineConfig(configOrOptions = {}) {
|
|
|
623
645
|
plugins: [...internalPlugins, ...options.plugins ?? []]
|
|
624
646
|
};
|
|
625
647
|
if (options.vite) config = mergeConfig(config, options.vite);
|
|
648
|
+
if (command === "serve" && isSandbox && bundledDevRequested()) {
|
|
649
|
+
const viteVersion = await resolveInstalledViteVersion();
|
|
650
|
+
if (viteVersionSupportsBundledDev(viteVersion)) config = mergeConfig(config, { experimental: { bundledDev: true } });
|
|
651
|
+
else logWarning(`Bundled dev requested (${BUNDLED_DEV_ENV_VAR}) but the installed vite (${viteVersion ?? "unresolved"}) is missing, prerelease, or below 8.1 — starting classic dev.`);
|
|
652
|
+
}
|
|
626
653
|
if (isSandbox) {
|
|
627
654
|
validateConfig(config);
|
|
628
655
|
config = cleanServerConfig(mergeConfig(config, { server: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lovable.dev/vite-tanstack-config",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.8.1",
|
|
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.1
|
|
21
|
+
"@lovable.dev/vite-plugin-hmr-gate": "^1.2.1",
|
|
22
22
|
"@tanstack/devtools-vite": "^0.8.1",
|
|
23
23
|
"lightningcss": "^1.30.0"
|
|
24
24
|
},
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"rimraf": "^5.0.0",
|
|
45
45
|
"tsdown": "^0.22.5",
|
|
46
46
|
"typescript": "7.0.2",
|
|
47
|
-
"vite": "^8.
|
|
47
|
+
"vite": "^8.1.5",
|
|
48
48
|
"vite-tsconfig-paths": "^6.0.2",
|
|
49
49
|
"vitest": "^4.1.5"
|
|
50
50
|
},
|