2021-03-31 17:14:56 +02:00
|
|
|
import svelte from "@sveltejs/vite-plugin-svelte"
|
|
|
|
import replace from "@rollup/plugin-replace"
|
|
|
|
|
|
|
|
import path from "path"
|
|
|
|
|
|
|
|
export default ({ mode }) => {
|
|
|
|
const isProduction = mode === "production"
|
|
|
|
return {
|
2021-05-07 09:17:21 +02:00
|
|
|
base: "/builder/",
|
2021-03-31 17:14:56 +02:00
|
|
|
build: {
|
|
|
|
minify: isProduction,
|
2021-03-31 20:58:30 +02:00
|
|
|
outDir: "../server/builder",
|
2021-03-31 17:14:56 +02:00
|
|
|
},
|
|
|
|
plugins: [
|
2021-03-31 20:12:28 +02:00
|
|
|
svelte({
|
|
|
|
hot: !isProduction,
|
|
|
|
emitCss: true,
|
|
|
|
}),
|
2021-03-31 17:14:56 +02:00
|
|
|
replace({
|
|
|
|
preventAssignment: true,
|
|
|
|
"process.env.NODE_ENV": JSON.stringify(
|
|
|
|
isProduction ? "production" : "development"
|
|
|
|
),
|
|
|
|
"process.env.POSTHOG_TOKEN": JSON.stringify(process.env.POSTHOG_TOKEN),
|
|
|
|
"process.env.POSTHOG_URL": JSON.stringify(process.env.POSTHOG_URL),
|
|
|
|
"process.env.SENTRY_DSN": JSON.stringify(process.env.SENTRY_DSN),
|
|
|
|
}),
|
|
|
|
],
|
|
|
|
optimizeDeps: {
|
|
|
|
exclude: ["@roxi/routify"],
|
|
|
|
},
|
|
|
|
resolve: {
|
|
|
|
dedupe: ["@roxi/routify"],
|
|
|
|
alias: [
|
|
|
|
{
|
|
|
|
find: "components",
|
|
|
|
replacement: path.resolve("./src/components"),
|
|
|
|
},
|
|
|
|
{
|
|
|
|
find: "builderStore",
|
|
|
|
replacement: path.resolve("./src/builderStore"),
|
|
|
|
},
|
2021-04-01 11:29:47 +02:00
|
|
|
{
|
|
|
|
find: "stores",
|
|
|
|
replacement: path.resolve("./src/stores"),
|
|
|
|
},
|
2021-03-31 17:14:56 +02:00
|
|
|
{
|
|
|
|
find: "constants",
|
|
|
|
replacement: path.resolve("./src/constants"),
|
|
|
|
},
|
|
|
|
{
|
|
|
|
find: "analytics",
|
|
|
|
replacement: path.resolve("./src/analytics"),
|
|
|
|
},
|
2021-05-06 14:58:42 +02:00
|
|
|
{
|
|
|
|
find: "actions",
|
|
|
|
replacement: path.resolve("./src/actions"),
|
|
|
|
},
|
2021-05-07 14:30:51 +02:00
|
|
|
{
|
|
|
|
find: "helperStores",
|
|
|
|
replacement: path.resolve("./src/helperStores"),
|
|
|
|
},
|
2021-05-06 17:39:34 +02:00
|
|
|
{
|
|
|
|
find: "helpers",
|
|
|
|
replacement: path.resolve("./src/helpers"),
|
|
|
|
},
|
2021-03-31 17:14:56 +02:00
|
|
|
],
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|