Rimuove le dipendenze da Lovable: l'app non gira più nel suo editor
Tolti il login social e il reporting errori verso l'editor Lovable (codice morto, mai importato o no-op in produzione), la cartella .lovable/ con i piani dell'editor, e riscritto vite.config.ts senza il preset @lovable.dev/vite-tanstack-config, esplicitando gli stessi plugin (TanStack Start, Tailwind, tsconfig-paths, React, Nitro/cloudflare) che forniva. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
d52ceeb0f9
commit
abd6fafc0c
16 files changed
+97
-401
No files matched your search
+91
-13
@@ -1,15 +1,93 @@
|
||||
// @lovable.dev/vite-tanstack-config already includes the following — do NOT add them manually
|
||||
// or the app will break with duplicate plugins:
|
||||
// - TanStack devtools (dev-only, first), tanstackStart, viteReact, tailwindcss, tsConfigPaths,
|
||||
// nitro (build-only using cloudflare as a default target), VITE_* env injection, @ path alias,
|
||||
// React/TanStack dedupe, error logger plugins, and sandbox detection (port/host/strictPort).
|
||||
// You can pass additional config via defineConfig({ vite: { ... }, etc... }) if needed.
|
||||
import { defineConfig } from "@lovable.dev/vite-tanstack-config";
|
||||
import { defineConfig, loadEnv, mergeConfig } from "vite";
|
||||
import tailwindcss from "@tailwindcss/vite";
|
||||
import tsConfigPaths from "vite-tsconfig-paths";
|
||||
import viteReact from "@vitejs/plugin-react";
|
||||
import { tanstackStart } from "@tanstack/react-start/plugin/vite";
|
||||
import { devtools } from "@tanstack/devtools-vite";
|
||||
|
||||
export default defineConfig({
|
||||
tanstackStart: {
|
||||
// Redirect TanStack Start's bundled server entry to src/server.ts (our SSR error wrapper).
|
||||
// nitro/vite builds from this
|
||||
server: { entry: "server" },
|
||||
},
|
||||
export default defineConfig(async ({ command, mode }) => {
|
||||
const isDevBuild = command === "build" && mode === "development";
|
||||
|
||||
const loadedEnv = loadEnv(mode, process.cwd(), "VITE_");
|
||||
const envDefine: Record<string, string> = {};
|
||||
for (const [key, value] of Object.entries(loadedEnv)) {
|
||||
envDefine[`import.meta.env.${key}`] = JSON.stringify(value);
|
||||
}
|
||||
|
||||
const plugins = [];
|
||||
if (mode === "development") {
|
||||
plugins.push(
|
||||
devtools({
|
||||
logging: false,
|
||||
eventBusConfig: { enabled: false },
|
||||
enhancedLogs: { enabled: false },
|
||||
consolePiping: { enabled: false },
|
||||
removeDevtoolsOnBuild: false,
|
||||
injectSource: { enabled: true },
|
||||
}),
|
||||
);
|
||||
}
|
||||
plugins.push(tailwindcss());
|
||||
plugins.push(tsConfigPaths({ projects: ["./tsconfig.json"] }));
|
||||
plugins.push(
|
||||
tanstackStart({
|
||||
importProtection: {
|
||||
behavior: "error",
|
||||
client: { files: ["**/server/**"], specifiers: ["server-only"] },
|
||||
},
|
||||
// Redirect TanStack Start's bundled server entry to src/server.ts (our SSR error wrapper).
|
||||
// nitro/vite builds from this
|
||||
server: { entry: "server" },
|
||||
}),
|
||||
);
|
||||
if (command === "build") {
|
||||
const { nitro } = await import("nitro/vite");
|
||||
plugins.push(nitro({ defaultPreset: "cloudflare-module" }));
|
||||
}
|
||||
plugins.push(viteReact());
|
||||
|
||||
let config = {
|
||||
define: envDefine,
|
||||
...(isDevBuild
|
||||
? {
|
||||
environments: {
|
||||
client: { define: { "process.env.NODE_ENV": JSON.stringify("development") } },
|
||||
},
|
||||
esbuild: { keepNames: true },
|
||||
}
|
||||
: {}),
|
||||
css: { transformer: "lightningcss" as const },
|
||||
resolve: {
|
||||
alias: { "@": `${process.cwd()}/src` },
|
||||
dedupe: [
|
||||
"react",
|
||||
"react-dom",
|
||||
"react/jsx-runtime",
|
||||
"react/jsx-dev-runtime",
|
||||
"@tanstack/react-query",
|
||||
"@tanstack/query-core",
|
||||
],
|
||||
},
|
||||
optimizeDeps: {
|
||||
include: [
|
||||
"react",
|
||||
"react-dom",
|
||||
"react-dom/client",
|
||||
"react/jsx-runtime",
|
||||
"react/jsx-dev-runtime",
|
||||
],
|
||||
ignoreOutdatedRequests: true,
|
||||
},
|
||||
plugins,
|
||||
};
|
||||
|
||||
config = mergeConfig(config, {
|
||||
server: {
|
||||
host: "::",
|
||||
port: 8080,
|
||||
watch: { awaitWriteFinish: { stabilityThreshold: 1000, pollInterval: 100 } },
|
||||
},
|
||||
});
|
||||
|
||||
return config;
|
||||
});
|
||||
Reference in new issue
Block a user