diff --git a/packages/bbui/vite.config.js b/packages/bbui/vite.config.js index 4c7da1c43e..b8a997dc4d 100644 --- a/packages/bbui/vite.config.js +++ b/packages/bbui/vite.config.js @@ -3,27 +3,30 @@ import { svelte } from "@sveltejs/vite-plugin-svelte" import postcss from "postcss" import path from "path" -export default defineConfig({ - build: { - sourcemap: true, - lib: { - entry: "src/index.js", - formats: ["es"], - fileName: "bbui.es", +export default defineConfig(({ mode }) => { + const isProduction = mode === "production" + return { + build: { + sourcemap: !isProduction, + lib: { + entry: "src/index.js", + formats: ["es"], + fileName: "bbui.es", + }, }, - }, - plugins: [ - svelte({ - emitCss: true, - }), - ], - css: { - postcss, - }, - resolve: { - alias: { - "@budibase/shared-core": path.resolve(__dirname, "../shared-core/src"), - "@budibase/types": path.resolve(__dirname, "../types/src"), + plugins: [ + svelte({ + emitCss: true, + }), + ], + css: { + postcss, }, - }, + resolve: { + alias: { + "@budibase/shared-core": path.resolve(__dirname, "../shared-core/src"), + "@budibase/types": path.resolve(__dirname, "../types/src"), + }, + }, + } })