Files
energy_storage/web/vue.config.js

65 lines
1.5 KiB
JavaScript
Raw Normal View History

const { defineConfig } = require('@vue/cli-service')
const path = require('path')
2025-08-29 12:06:02 +08:00
module.exports = defineConfig({
transpileDependencies: true,
publicPath: '/',
2025-08-29 12:06:02 +08:00
// 输出文件目录
outputDir: 'dist',
2025-08-29 12:06:02 +08:00
// 静态资源目录
assetsDir: 'static',
2025-08-29 12:06:02 +08:00
devServer: {
2025-09-04 11:12:20 +08:00
proxy: {
'/api': {
// 代理前缀,可以自定义(如 '/api'
target: 'http://192.168.0.187:19801', // 目标服务器地址
changeOrigin: true, // 是否改变请求源(跨域必备)
pathRewrite: {
'^/api': '' // 重写路径,去掉 '/api' 前缀
}
}
}
2025-08-29 12:06:02 +08:00
},
css: {
loaderOptions: {
scss: {
additionalData: `
@import "@/style/color.scss";
@import "@/style/antd.scss";
` //在每个 .scss 文件顶部自动添加这行代码,无需手动导入
}
2025-08-29 12:06:02 +08:00
},
extract: {
ignoreOrder: true // 忽略 CSS 顺序警告
}
2025-08-29 12:06:02 +08:00
},
// webpack相关配置
2025-08-29 12:06:02 +08:00
configureWebpack: {
// 自定义打包入口
// 扩展 webpack 配置
plugins: [
// 添加插件
],
2025-08-29 12:06:02 +08:00
resolve: {
alias: {
'@': path.join(__dirname, 'src')
}
}
2025-08-29 12:06:02 +08:00
},
// 是否在开发环境下通过 eslint-loader 在每次保存时 lint 代码
lintOnSave: process.env.NODE_ENV !== 'production',
2025-08-29 12:06:02 +08:00
// 是否使用包含运行时编译器的 Vue 构建版本
runtimeCompiler: false,
// 生产环境的 source map
productionSourceMap: true,
// 第三方插件配置
pluginOptions: {
// ...
}
})