refactor(vite): improve environment variable handling in Vite configuration
This commit is contained in:
parent
50750eb9e4
commit
2d3ac5a62a
1 changed files with 35 additions and 31 deletions
|
|
@ -1,8 +1,11 @@
|
|||
import { defineConfig } from "vite";
|
||||
import { defineConfig, loadEnv } from "vite";
|
||||
import laravel from "laravel-vite-plugin";
|
||||
import vue from "@vitejs/plugin-vue";
|
||||
|
||||
export default defineConfig({
|
||||
export default defineConfig(({ mode }) => {
|
||||
const env = loadEnv(mode, process.cwd(), '')
|
||||
|
||||
return {
|
||||
server: {
|
||||
watch: {
|
||||
ignored: [
|
||||
|
|
@ -12,7 +15,7 @@ export default defineConfig({
|
|||
},
|
||||
host: "0.0.0.0",
|
||||
hmr: {
|
||||
host: process.env.VITE_HOST,
|
||||
host: env.VITE_HOST || '0.0.0.0'
|
||||
},
|
||||
},
|
||||
plugins: [
|
||||
|
|
@ -34,4 +37,5 @@ export default defineConfig({
|
|||
vue: "vue/dist/vue.esm-bundler.js",
|
||||
},
|
||||
},
|
||||
}
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue