From 0570ac4e4d7db52a5b7dac7e4ca38332a5aac97c Mon Sep 17 00:00:00 2001 From: Zn4rK Date: Fri, 18 Oct 2024 13:55:03 +0200 Subject: [PATCH] sourceMaps only for dev mode --- packages/vite-plugin/src/index.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/vite-plugin/src/index.ts b/packages/vite-plugin/src/index.ts index 93055cd..0569df6 100644 --- a/packages/vite-plugin/src/index.ts +++ b/packages/vite-plugin/src/index.ts @@ -27,14 +27,17 @@ export function navita(options?: Options) { let lastCssContent: string | undefined; let context: string; let isSSR = false; + let isDEV = true; return { enforce: "pre", name: "navita", config(_, env) { + isDEV = env.command === 'serve'; + return { optimizeDeps: { - include: env.command === 'serve' ? ['@navita/css'] : [], + include: isDEV ? ['@navita/css'] : [], }, ssr: { external: [ @@ -58,9 +61,8 @@ export function navita(options?: Options) { } const defaultEngineOptions = { - // Only for development ? - enableSourceMaps: true, - enableDebugIdentifiers: true, + enableSourceMaps: isDEV, + enableDebugIdentifiers: isDEV, ...(options?.engineOptions || {}), };