项目初始化
This commit is contained in:
38
vite.config.js
Normal file
38
vite.config.js
Normal file
@@ -0,0 +1,38 @@
|
||||
import { fileURLToPath, URL } from 'node:url'
|
||||
import path from "path";
|
||||
import { defineConfig } from 'vite'
|
||||
import vue from '@vitejs/plugin-vue'
|
||||
import { codeInspectorPlugin } from 'code-inspector-plugin'
|
||||
|
||||
// https://vite.dev/config/
|
||||
export default defineConfig({
|
||||
plugins: [
|
||||
vue(),
|
||||
codeInspectorPlugin({
|
||||
bundler: 'vite', // 使用 vite
|
||||
showSwitch: true,
|
||||
}),
|
||||
],
|
||||
server: {
|
||||
port: 3000,
|
||||
open: true,
|
||||
hmr: { overlay: false },
|
||||
proxy: {
|
||||
'/dev-api': {
|
||||
target: 'https://xsynergy.gxtech.ltd', // 从环境变量读取
|
||||
changeOrigin: true,
|
||||
ws: true,
|
||||
rewrite: (path) =>
|
||||
path.replace(new RegExp(`^/dev-api`), '')
|
||||
}
|
||||
}
|
||||
},
|
||||
resolve: {
|
||||
alias: {
|
||||
"@": path.resolve(__dirname, "./src"),
|
||||
},
|
||||
},
|
||||
css: {
|
||||
postcss: './postcss.config.js' // 纯外部配置
|
||||
},
|
||||
})
|
||||
Reference in New Issue
Block a user