Skip to content

Commit dfa4381

Browse files
authored
Update vite.config.mjs
1 parent 6b9c7c6 commit dfa4381

File tree

1 file changed

+5
-29
lines changed

1 file changed

+5
-29
lines changed

vite.config.mjs

+5-29
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,18 @@
1-
import { defineConfig, loadEnv } from 'vite'
1+
import { defineConfig } from 'vite'
22
import vue from '@vitejs/plugin-vue'
33
import path from 'node:path'
44
import autoprefixer from 'autoprefixer'
55

6-
export default defineConfig(({ mode }) => {
7-
// Load .env
8-
const viteEnv = loadEnv(mode, process.cwd(), '')
9-
const env = {}
10-
11-
// Filter env to variables starting with VITE_APP or VUE_APP
12-
Object.entries({...process.env, ...viteEnv}).forEach(([key, value]) => {
13-
if (key.startsWith('VITE_APP') || key.startsWith('VUE_APP')) {
14-
env[key] = value
15-
}
16-
})
17-
6+
export default defineConfig(() => {
187
return {
198
plugins: [vue()],
209
base: './',
2110
css: {
2211
postcss: {
2312
plugins: [
24-
autoprefixer({}) // add options if needed
13+
autoprefixer({}), // add options if needed
2514
],
26-
}
15+
},
2716
},
2817
resolve: {
2918
alias: [
@@ -41,26 +30,13 @@ export default defineConfig(({ mode }) => {
4130
replacement: path.resolve(__dirname, '/src'),
4231
},
4332
],
44-
extensions: [
45-
'.mjs',
46-
'.js',
47-
'.ts',
48-
'.jsx',
49-
'.tsx',
50-
'.json',
51-
'.vue',
52-
'.scss',
53-
],
33+
extensions: ['.mjs', '.js', '.ts', '.jsx', '.tsx', '.json', '.vue', '.scss'],
5434
},
5535
server: {
5636
port: 3000,
5737
proxy: {
5838
// https://vitejs.dev/config/server-options.html
5939
},
6040
},
61-
define: {
62-
// vitejs does not support process.env so we have to redefine it
63-
'process.env': env,
64-
},
6541
}
6642
})

0 commit comments

Comments
 (0)