1
0
Fork 0
mirror of synced 2024-07-15 03:05:57 +12:00
budibase/packages/builder/vite.config.js
Gerard Burns dd343a5946 New App Onboarding (#9489)
* New App Onboarding

* Lint

* Move app creation onboarding into its own route

* Fix quiet action button variant

* Fix alt attribute background image flashing

* Update routing logic and redirects to show app creation onboarding

* Navigate to data rather than design upon initial app creation to allow tour to function properly

* Tidy up popover logic and remove tip functionality

* Fix binding popovers

* Lint

* Silence spammy warnings from the builder

* Exclude SVG files from rollup plugin image to fix spectrum icons

* Fix help menu icon colours not working in light themes

* Tweak help menu styles

---------

Co-authored-by: Andrew Kingston <andrew@kingston.dev>
2023-01-31 19:34:32 +00:00

104 lines
2.6 KiB
JavaScript

import { svelte } from "@sveltejs/vite-plugin-svelte"
import replace from "@rollup/plugin-replace"
import { defineConfig, loadEnv } from "vite"
import path from "path"
const ignoredWarnings = [
"unused-export-let",
"css-unused-selector",
"module-script-reactive-declaration",
"a11y-no-onchange",
"a11y-click-events-have-key-events",
]
export default defineConfig(({ mode }) => {
const isProduction = mode === "production"
const env = loadEnv(mode, process.cwd())
return {
server: {
fs: {
strict: false,
},
hmr: {
protocol: env.VITE_HMR_PROTOCOL || "ws",
clientPort: env.VITE_HMR_CLIENT_PORT || 3000,
path: env.VITE_HMR_PATH || "/",
},
port: 3000,
},
base: "/builder/",
build: {
minify: isProduction,
outDir: "../server/builder",
sourcemap: !isProduction,
},
plugins: [
svelte({
hot: !isProduction,
emitCss: true,
onwarn: (warning, handler) => {
// Ignore some warnings
if (!ignoredWarnings.includes(warning.code)) {
handler(warning)
}
},
}),
replace({
preventAssignment: true,
"process.env.NODE_ENV": JSON.stringify(
isProduction ? "production" : "development"
),
"process.env.POSTHOG_TOKEN": JSON.stringify(process.env.POSTHOG_TOKEN),
"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"),
},
{
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"),
},
{
find: "actions",
replacement: path.resolve("./src/actions"),
},
{
find: "helpers",
replacement: path.resolve("./src/helpers"),
},
],
},
}
})