@lovable.dev/vite-tanstack-config 2.6.4-rc.0 → 2.6.5
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/README.md +14 -0
- package/dist/index.cjs +1 -28
- package/dist/index.js +2 -29
- package/package.json +2 -2
package/README.md
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# @lovable.dev/vite-tanstack-config
|
|
2
|
+
|
|
3
|
+
Vite config wrapper for Lovable TanStack Start projects.
|
|
4
|
+
|
|
5
|
+
## What It Does
|
|
6
|
+
|
|
7
|
+
- Gives TanStack Start projects a single `defineConfig` helper for local preview and production builds.
|
|
8
|
+
- Keeps Lovable sandbox previews predictable by setting the server shape, watched paths, HMR coordination, and asset routing expected by the platform.
|
|
9
|
+
- Adds diagnostics that help the preview tell build, Vite, SSR, and app errors apart.
|
|
10
|
+
- Produces deployable build output for Lovable while still letting self-hosted projects choose their own target.
|
|
11
|
+
|
|
12
|
+
## Customization
|
|
13
|
+
|
|
14
|
+
Apps can pass through Vite options and adjust the React, TanStack Start, Nitro, HMR gate, and error-logging behavior when they need to.
|
package/dist/index.cjs
CHANGED
|
@@ -118,7 +118,6 @@ function lovableAssetsProxyPlugin() {
|
|
|
118
118
|
// src/index.ts
|
|
119
119
|
var SANDBOX_ENV_VAR = "DEV_SERVER__PROJECT_PATH";
|
|
120
120
|
var LOVABLE_SANDBOX_ENV_VAR = "LOVABLE_SANDBOX";
|
|
121
|
-
var JSX_SOURCE_FILE_RE = /\.[jt]sx$/;
|
|
122
121
|
function isSandboxEnvironment() {
|
|
123
122
|
return process.env[LOVABLE_SANDBOX_ENV_VAR] === "1" || !!process.env[SANDBOX_ENV_VAR];
|
|
124
123
|
}
|
|
@@ -609,29 +608,6 @@ function devServerFnErrorLogger() {
|
|
|
609
608
|
}
|
|
610
609
|
};
|
|
611
610
|
}
|
|
612
|
-
function jsxSourceBuildDevPlugin() {
|
|
613
|
-
return {
|
|
614
|
-
name: "lovable-jsx-source-build-dev",
|
|
615
|
-
enforce: "pre",
|
|
616
|
-
apply: "build",
|
|
617
|
-
async transform(code, id, options) {
|
|
618
|
-
if (options?.ssr) {
|
|
619
|
-
return null;
|
|
620
|
-
}
|
|
621
|
-
const sourceFile = id.split("?")[0];
|
|
622
|
-
if (!sourceFile || !JSX_SOURCE_FILE_RE.test(sourceFile) || !code.includes("<")) {
|
|
623
|
-
return null;
|
|
624
|
-
}
|
|
625
|
-
return (0, import_vite.transformWithEsbuild)(code, sourceFile, {
|
|
626
|
-
loader: sourceFile.endsWith(".jsx") ? "jsx" : "tsx",
|
|
627
|
-
jsx: "automatic",
|
|
628
|
-
jsxDev: true,
|
|
629
|
-
sourcemap: true,
|
|
630
|
-
sourcefile: sourceFile
|
|
631
|
-
});
|
|
632
|
-
}
|
|
633
|
-
};
|
|
634
|
-
}
|
|
635
611
|
function defineConfig(configOrOptions = {}) {
|
|
636
612
|
return async (env) => {
|
|
637
613
|
const { command, mode } = env;
|
|
@@ -717,9 +693,6 @@ function defineConfig(configOrOptions = {}) {
|
|
|
717
693
|
internalPlugins.push(nitro(nitroOpts));
|
|
718
694
|
}
|
|
719
695
|
}
|
|
720
|
-
if (isDevBuild) {
|
|
721
|
-
internalPlugins.push(jsxSourceBuildDevPlugin());
|
|
722
|
-
}
|
|
723
696
|
const viteReact = (await import("@vitejs/plugin-react")).default;
|
|
724
697
|
internalPlugins.push(viteReact(options.react));
|
|
725
698
|
if (command === "serve") {
|
|
@@ -738,7 +711,7 @@ function defineConfig(configOrOptions = {}) {
|
|
|
738
711
|
if (command === "serve") {
|
|
739
712
|
internalPlugins.push(lovableAssetsProxyPlugin());
|
|
740
713
|
}
|
|
741
|
-
if (
|
|
714
|
+
if (command === "serve" && mode === "development") {
|
|
742
715
|
internalPlugins.push((0, import_lovable_tagger.componentTagger)({ jsxSource: true }));
|
|
743
716
|
}
|
|
744
717
|
let envDefine = {};
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// src/index.ts
|
|
2
2
|
import { componentTagger } from "lovable-tagger";
|
|
3
|
-
import { mergeConfig, loadEnv
|
|
3
|
+
import { mergeConfig, loadEnv } from "vite";
|
|
4
4
|
|
|
5
5
|
// src/assetsProxyPlugin.ts
|
|
6
6
|
import https from "https";
|
|
@@ -83,7 +83,6 @@ function lovableAssetsProxyPlugin() {
|
|
|
83
83
|
// src/index.ts
|
|
84
84
|
var SANDBOX_ENV_VAR = "DEV_SERVER__PROJECT_PATH";
|
|
85
85
|
var LOVABLE_SANDBOX_ENV_VAR = "LOVABLE_SANDBOX";
|
|
86
|
-
var JSX_SOURCE_FILE_RE = /\.[jt]sx$/;
|
|
87
86
|
function isSandboxEnvironment() {
|
|
88
87
|
return process.env[LOVABLE_SANDBOX_ENV_VAR] === "1" || !!process.env[SANDBOX_ENV_VAR];
|
|
89
88
|
}
|
|
@@ -574,29 +573,6 @@ function devServerFnErrorLogger() {
|
|
|
574
573
|
}
|
|
575
574
|
};
|
|
576
575
|
}
|
|
577
|
-
function jsxSourceBuildDevPlugin() {
|
|
578
|
-
return {
|
|
579
|
-
name: "lovable-jsx-source-build-dev",
|
|
580
|
-
enforce: "pre",
|
|
581
|
-
apply: "build",
|
|
582
|
-
async transform(code, id, options) {
|
|
583
|
-
if (options?.ssr) {
|
|
584
|
-
return null;
|
|
585
|
-
}
|
|
586
|
-
const sourceFile = id.split("?")[0];
|
|
587
|
-
if (!sourceFile || !JSX_SOURCE_FILE_RE.test(sourceFile) || !code.includes("<")) {
|
|
588
|
-
return null;
|
|
589
|
-
}
|
|
590
|
-
return transformWithEsbuild(code, sourceFile, {
|
|
591
|
-
loader: sourceFile.endsWith(".jsx") ? "jsx" : "tsx",
|
|
592
|
-
jsx: "automatic",
|
|
593
|
-
jsxDev: true,
|
|
594
|
-
sourcemap: true,
|
|
595
|
-
sourcefile: sourceFile
|
|
596
|
-
});
|
|
597
|
-
}
|
|
598
|
-
};
|
|
599
|
-
}
|
|
600
576
|
function defineConfig(configOrOptions = {}) {
|
|
601
577
|
return async (env) => {
|
|
602
578
|
const { command, mode } = env;
|
|
@@ -682,9 +658,6 @@ function defineConfig(configOrOptions = {}) {
|
|
|
682
658
|
internalPlugins.push(nitro(nitroOpts));
|
|
683
659
|
}
|
|
684
660
|
}
|
|
685
|
-
if (isDevBuild) {
|
|
686
|
-
internalPlugins.push(jsxSourceBuildDevPlugin());
|
|
687
|
-
}
|
|
688
661
|
const viteReact = (await import("@vitejs/plugin-react")).default;
|
|
689
662
|
internalPlugins.push(viteReact(options.react));
|
|
690
663
|
if (command === "serve") {
|
|
@@ -703,7 +676,7 @@ function defineConfig(configOrOptions = {}) {
|
|
|
703
676
|
if (command === "serve") {
|
|
704
677
|
internalPlugins.push(lovableAssetsProxyPlugin());
|
|
705
678
|
}
|
|
706
|
-
if (
|
|
679
|
+
if (command === "serve" && mode === "development") {
|
|
707
680
|
internalPlugins.push(componentTagger({ jsxSource: true }));
|
|
708
681
|
}
|
|
709
682
|
let envDefine = {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lovable.dev/vite-tanstack-config",
|
|
3
|
-
"version": "2.6.
|
|
3
|
+
"version": "2.6.5",
|
|
4
4
|
"description": "Vite config wrapper for Lovable TanStack Start projects",
|
|
5
5
|
"main": "./dist/index.cjs",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"license": "MIT",
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@lovable.dev/vite-plugin-dev-server-bridge": "^1.0.2",
|
|
30
|
-
"@lovable.dev/vite-plugin-hmr-gate": "^1.1.
|
|
30
|
+
"@lovable.dev/vite-plugin-hmr-gate": "^1.1.1",
|
|
31
31
|
"lightningcss": "^1.30.0",
|
|
32
32
|
"lovable-tagger": "1.2.0"
|
|
33
33
|
},
|