1
0
Fork 0
mirror of synced 2024-06-26 18:10:51 +12:00
budibase/packages/builder/vite.config.js

91 lines
2.2 KiB
JavaScript
Raw Normal View History

import { svelte } from "@sveltejs/vite-plugin-svelte"
import replace from "@rollup/plugin-replace"
2022-08-16 21:26:23 +12:00
import { defineConfig, loadEnv } from "vite"
import path from "path"
2022-08-16 21:26:23 +12:00
export default defineConfig(({ mode }) => {
const isProduction = mode === "production"
2022-08-16 21:26:23 +12:00
const env = loadEnv(mode, process.cwd())
return {
server: {
fs: {
strict: false,
},
2022-08-16 21:26:23 +12:00
hmr: {
protocol: env.VITE_HMR_PROTOCOL || "ws",
2022-08-16 21:26:23 +12:00
clientPort: env.VITE_HMR_CLIENT_PORT || 3000,
2022-08-17 03:27:03 +12:00
path: env.VITE_HMR_PATH || "/",
},
2022-08-19 22:49:11 +12:00
port: 3000,
},
base: "/builder/",
build: {
minify: isProduction,
outDir: "../server/builder",
sourcemap: !isProduction,
},
plugins: [
2021-04-01 07:12:28 +13:00
svelte({
hot: !isProduction,
emitCss: true,
}),
replace({
preventAssignment: true,
"process.env.NODE_ENV": JSON.stringify(
isProduction ? "production" : "development"
),
"process.env.POSTHOG_TOKEN": JSON.stringify(process.env.POSTHOG_TOKEN),
2021-09-21 22:47:14 +12:00
"process.env.INTERCOM_TOKEN": JSON.stringify(
process.env.INTERCOM_TOKEN
),
"process.env.SENTRY_DSN": JSON.stringify(process.env.SENTRY_DSN),
}),
],
optimizeDeps: {
exclude: ["@roxi/routify"],
},
resolve: {
dedupe: ["@roxi/routify"],
alias: [
{
find: "assets",
replacement: path.resolve("./assets"),
},
{
find: "components",
replacement: path.resolve("./src/components"),
},
{
find: "builderStore",
replacement: path.resolve("./src/builderStore"),
},
2021-04-01 22:29:47 +13:00
{
find: "stores",
replacement: path.resolve("./src/stores"),
},
{
find: "api",
replacement: path.resolve("./src/api.js"),
},
{
find: "constants",
replacement: path.resolve("./src/constants"),
},
{
find: "analytics",
replacement: path.resolve("./src/analytics"),
},
2021-05-07 00:58:42 +12:00
{
find: "actions",
replacement: path.resolve("./src/actions"),
},
{
find: "helpers",
replacement: path.resolve("./src/helpers"),
},
],
},
}
2022-08-16 21:26:23 +12:00
})