35 lines
710 B
JavaScript
35 lines
710 B
JavaScript
|
|
const { defineConfig } = require('@vue/cli-service')
|
|||
|
|
|
|||
|
|
module.exports = defineConfig({
|
|||
|
|
transpileDependencies: true,
|
|||
|
|
|
|||
|
|
// 生产/开发环境配置
|
|||
|
|
publicPath: process.env.NODE_ENV === 'production' ? '/' : '/',
|
|||
|
|
outputDir: 'dist',
|
|||
|
|
assetsDir: 'static',
|
|||
|
|
|
|||
|
|
// 开发服务器配置
|
|||
|
|
devServer: {
|
|||
|
|
port: 8081,
|
|||
|
|
proxy: {
|
|||
|
|
'/api': {
|
|||
|
|
// 开发时代理到本地后端(统一为 localhost:8080)
|
|||
|
|
target: 'http://localhost:8080',
|
|||
|
|
changeOrigin: true
|
|||
|
|
// 不要移除 /api 前缀,后端路由以 /api 开头
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
},
|
|||
|
|
|
|||
|
|
// 生产环境配置
|
|||
|
|
configureWebpack: {
|
|||
|
|
optimization: {
|
|||
|
|
splitChunks: {
|
|||
|
|
chunks: 'all'
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
})
|
|||
|
|
|
|||
|
|
|