Files
martial-admin-mini/vue.config.js
2025-12-17 09:23:27 +08:00

45 lines
836 B
JavaScript

module.exports = {
// 输出目录
outputDir: 'dist/build/h5',
// 静态资源目录
assetsDir: 'static',
// 公共路径 - 重要!确保静态资源能正确加载
publicPath: process.env.NODE_ENV === 'production' ? './' : '/',
// 生产环境配置
productionSourceMap: false,
// CSS 提取配置
css: {
extract: true,
sourceMap: false
},
// 开发服务器配置
devServer: {
port: 8080,
open: true,
overlay: {
warnings: false,
errors: true
}
},
chainWebpack: config => {
// 禁用 gzip 大小报告
if (process.env.NODE_ENV === 'production') {
config.performance.hints(false)
}
// 确保 CSS 文件正确处理
config.module
.rule('vue')
.use('vue-loader')
.tap(options => {
return options
})
}
}