Skip to content

Commit d9ba06d

Browse files
committed
build fix.
1 parent 5fe6988 commit d9ba06d

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

vite.config.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
11
// vite.config.js
2-
const { defineConfig } = require('vite')
2+
import { defineConfig, loadEnv } from 'vite'
33

4-
module.exports = defineConfig({
5-
base: '/', // or '/<REPO>/' if deploying to a repository
6-
plugins: []
4+
export default defineConfig(({ command, mode }) => {
5+
// 현재 작업 디렉터리의 `mode`를 기반으로 env 파일을 불러옴
6+
// 세 번째 매개변수를 ''로 설정하면 `VITE_` 접두사에 관계없이 모든 환경 변수를 불러옴
7+
const env = loadEnv(mode, process.cwd(), '')
8+
return {
9+
base: '//', // or '/<REPO>/' if deploying to a repository
10+
plugins: [],
11+
define: {
12+
}
13+
}
714
})

0 commit comments

Comments
 (0)