Support env variables for vite config
This commit is contained in:
parent
04f49fd7b9
commit
4645901309
|
@ -1,15 +1,22 @@
|
|||
import { svelte } from "@sveltejs/vite-plugin-svelte"
|
||||
import replace from "@rollup/plugin-replace"
|
||||
import { defineConfig, loadEnv } from "vite"
|
||||
|
||||
import path from "path"
|
||||
|
||||
export default ({ mode }) => {
|
||||
export default defineConfig(({ mode }) => {
|
||||
const isProduction = mode === "production"
|
||||
const env = loadEnv(mode, process.cwd())
|
||||
return {
|
||||
server: {
|
||||
fs: {
|
||||
strict: false,
|
||||
},
|
||||
hmr: {
|
||||
protocol: "wss",
|
||||
clientPort: env.VITE_HMR_CLIENT_PORT || 3000,
|
||||
path: env.VITE_HMR_PATH || "/"
|
||||
}
|
||||
},
|
||||
base: "/builder/",
|
||||
build: {
|
||||
|
@ -79,4 +86,4 @@ export default ({ mode }) => {
|
|||
],
|
||||
},
|
||||
}
|
||||
}
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue