Files
energy_storage/web/vue.config.js
2025-09-04 11:12:20 +08:00

66 lines
1.5 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
const { defineConfig } = require('@vue/cli-service')
const path = require('path')
module.exports = defineConfig({
transpileDependencies: true,
publicPath: '/',
// 输出文件目录
outputDir: 'dist',
// 静态资源目录
assetsDir: 'static',
devServer: {
proxy: {
'/api': {
// 代理前缀,可以自定义(如 '/api'
target: 'http://192.168.0.187:19801', // 目标服务器地址
changeOrigin: true, // 是否改变请求源(跨域必备)
pathRewrite: {
'^/api': '' // 重写路径,去掉 '/api' 前缀
}
}
}
},
css: {
loaderOptions: {
scss: {
additionalData: `
@import "@/style/color.scss";
@import "@/style/antd.scss";
` //在每个 .scss 文件顶部自动添加这行代码,无需手动导入
}
},
extract: {
filename: `css/.[contenthash:8].css`,
chunkFilename: `css/.[contenthash:8].chunk.css`
}
},
// webpack相关配置
configureWebpack: {
// 自定义打包入口
// 扩展 webpack 配置
plugins: [
// 添加插件
],
resolve: {
alias: {
'@': path.join(__dirname, 'src')
}
}
},
// 是否在开发环境下通过 eslint-loader 在每次保存时 lint 代码
lintOnSave: process.env.NODE_ENV !== 'production',
// 是否使用包含运行时编译器的 Vue 构建版本
runtimeCompiler: false,
// 生产环境的 source map
productionSourceMap: true,
// 第三方插件配置
pluginOptions: {
// ...
}
})