-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: vite 프록시 설정 * feat: apiClient baseURL주소 수정 * refactor: manualChunks 옵션 제거
- Loading branch information
Showing
3 changed files
with
32 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,37 @@ | ||
import path from 'path' | ||
import react from '@vitejs/plugin-react' | ||
import { defineConfig } from 'vite' | ||
import { defineConfig, loadEnv } from 'vite' | ||
import svgr from 'vite-plugin-svgr' | ||
|
||
export default defineConfig({ | ||
plugins: [react(), svgr()], | ||
resolve: { | ||
alias: [{ find: '@', replacement: path.resolve(__dirname, 'src') }], | ||
}, | ||
// 환경 변수 로드 | ||
export default ({ mode }) => { | ||
const env = { ...process.env, ...loadEnv(mode, process.cwd()) } | ||
|
||
build: { | ||
rollupOptions: { | ||
external: (id) => { | ||
if (id.includes('/node_modules/@mswjs')) { | ||
return true | ||
} | ||
if (id.includes('/src/mocks')) { | ||
return true | ||
} | ||
return defineConfig({ | ||
plugins: [react(), svgr()], | ||
resolve: { | ||
alias: [{ find: '@', replacement: path.resolve(__dirname, 'src') }], | ||
}, | ||
build: { | ||
rollupOptions: { | ||
external: (id) => { | ||
if (id.includes('/node_modules/@mswjs')) { | ||
return true | ||
} | ||
if (id.includes('/src/mocks')) { | ||
return true | ||
} | ||
}, | ||
}, | ||
}, | ||
server: { | ||
proxy: { | ||
'/api': { | ||
target: env.VITE_API_KEY, | ||
changeOrigin: true, | ||
rewrite: (path) => path.replace(/^\/api/, ''), | ||
}, | ||
}, | ||
}, | ||
}, | ||
}) | ||
}) | ||
} |