react_basic/vite.config.ts

37 lines
1.2 KiB
TypeScript

import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import { fileURLToPath, URL } from 'url'
// https://vitejs.dev/config/
export default defineConfig({
server: {
host: true, // 0.0.0.0 바인딩 (프록시/외부 접근 허용)
port: 5173,
allowedHosts: [
'react.sokuree.com', // 역방향 프록시로 들어오는 Host 명시 허용
],
},
plugins: [react()],
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url)),
'@assets': fileURLToPath(new URL('./src/assets', import.meta.url)),
'@components': fileURLToPath(new URL('./src/components', import.meta.url)),
'@pages': fileURLToPath(new URL('./src/pages', import.meta.url)),
'@recoil': fileURLToPath(new URL('./src/recoil', import.meta.url)),
'@types': fileURLToPath(new URL('./src/types', import.meta.url)),
'@apis': fileURLToPath(new URL('./src/apis', import.meta.url)),
},
},
// SCSS 전역 사용
css: {
preprocessorOptions: {
scss: {
additionalData: `@use "${fileURLToPath(
new URL('./src/assets/styles/main.scss', import.meta.url)
)}" as *;`,
},
},
},
})