mirror of
https://gitee.com/js-yhsec/energy_storage.git
synced 2026-05-27 18:59:26 +08:00
85 lines
2.1 KiB
JavaScript
85 lines
2.1 KiB
JavaScript
const { defineConfig } = require('@vue/cli-service')
|
||
const path = require('path')
|
||
const Components = require('unplugin-vue-components/webpack')
|
||
const { AntDesignVueResolver } = require('unplugin-vue-components/resolvers')
|
||
module.exports = defineConfig({
|
||
transpileDependencies: true,
|
||
publicPath: '/',
|
||
// 输出文件目录
|
||
outputDir: 'dist',
|
||
|
||
// 静态资源目录
|
||
assetsDir: 'static',
|
||
devServer: {
|
||
proxy: {
|
||
'/api': {
|
||
// 代理前缀,可以自定义(如 '/api')
|
||
target: 'http://192.168.0.187:19800', // 目标服务器地址
|
||
changeOrigin: true, // 是否改变请求源(跨域必备)
|
||
pathRewrite: {
|
||
'^/api': '' // 重写路径,去掉 '/api' 前缀
|
||
}
|
||
}
|
||
}
|
||
},
|
||
css: {
|
||
loaderOptions: {
|
||
scss: {
|
||
additionalData: `
|
||
@import "@/style/color.scss";
|
||
@import "@/style/antd.scss";
|
||
` //在每个 .scss 文件顶部自动添加这行代码,无需手动导入
|
||
},
|
||
less: {
|
||
lessOptions: {
|
||
modifyVars: {
|
||
//这是配置css主题色
|
||
'primary-color': '#143d7d'
|
||
},
|
||
javascriptEnabled: true
|
||
}
|
||
}
|
||
},
|
||
extract: {
|
||
ignoreOrder: true // 忽略 CSS 顺序警告
|
||
}
|
||
},
|
||
|
||
// webpack相关配置
|
||
configureWebpack: {
|
||
// 自定义打包入口
|
||
|
||
// 扩展 webpack 配置
|
||
plugins: [
|
||
Components({
|
||
resolvers: [
|
||
AntDesignVueResolver({
|
||
resolveIcons: true, // 自动按需加载图标,
|
||
importStyle: false //不单独导入样式,对样式进行全局引入
|
||
})
|
||
],
|
||
dts: true // 生成类型声明
|
||
})
|
||
],
|
||
resolve: {
|
||
alias: {
|
||
'@': path.join(__dirname, 'src')
|
||
}
|
||
}
|
||
},
|
||
|
||
// 是否在开发环境下通过 eslint-loader 在每次保存时 lint 代码
|
||
lintOnSave: process.env.NODE_ENV !== 'production',
|
||
|
||
// 是否使用包含运行时编译器的 Vue 构建版本
|
||
runtimeCompiler: false,
|
||
|
||
// 生产环境的 source map
|
||
productionSourceMap: true,
|
||
|
||
// 第三方插件配置
|
||
pluginOptions: {
|
||
// ...
|
||
}
|
||
})
|