chore: init bj_power monorepo (dashboard/mes/wms/wms_client/workstation), clear subproject git metadata and align naming to folder names
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
import {defineConfig, loadEnv, type UserConfig} from 'vite'
|
||||
import react from '@vitejs/plugin-react'
|
||||
import {resolve} from 'path'
|
||||
import {viteMockServe} from 'vite-plugin-mock'
|
||||
|
||||
// https://vitejs.dev/config/
|
||||
export default defineConfig(({ command, mode }) => {
|
||||
const env = loadEnv(mode, process.cwd())
|
||||
const useMock = env.VITE_USE_MOCK === 'true'
|
||||
return {
|
||||
assetsInclude: ['**/*.svg', '**/*.png'],
|
||||
resolve: {
|
||||
basedir: './',
|
||||
alias: {
|
||||
'@': resolve(__dirname, './src')
|
||||
}
|
||||
},
|
||||
plugins: [
|
||||
react(),
|
||||
viteMockServe({
|
||||
mockPath: 'mock',
|
||||
enable: command === 'serve' && useMock,
|
||||
}),
|
||||
],
|
||||
css: {
|
||||
preprocessorOptions: {
|
||||
scss: {
|
||||
api: 'legacy', // 使用 legacy API 兼容旧版 sass
|
||||
},
|
||||
},
|
||||
},
|
||||
server: {
|
||||
host: '0.0.0.0',
|
||||
port: env.VITE_PORT,
|
||||
open: true,
|
||||
cors: true,
|
||||
hmr: {
|
||||
host: 'localhost', // 修复 HMR WebSocket 连接问题
|
||||
},
|
||||
proxy: {
|
||||
'^/(api/*|sse$|uploads/*)': {
|
||||
target: 'http://127.0.0.1:8888',
|
||||
ws: false,
|
||||
changeOrigin: true
|
||||
// rewrite: (path) => path.replace(/^\/api/, ''),
|
||||
}
|
||||
}
|
||||
}
|
||||
} as unknown as UserConfig
|
||||
})
|
||||
Reference in New Issue
Block a user