1 Star 0 Fork 23

大大白菜 / admin-antd-vue

forked from lqs / admin-antd-vue 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
vue.config.js 2.24 KB
一键复制 编辑 原始数据 按行查看 历史
李庆松 提交于 2020-12-03 20:21 . init
/* eslint-disable @typescript-eslint/no-var-requires */
const bodyParser = require('body-parser')
const mockServer = require('./src/utils/mock/server');
const { NODE_ENV, VUE_APP_PORT, VUE_APP_MOCK } = process.env;
module.exports = {
publicPath: '/',
outputDir: 'dist',
productionSourceMap: false,
devServer: {
port: VUE_APP_PORT || 8000,
// 配置反向代理
/*
proxy: {
'/api': {
target: '<url>',
ws: true,
changeOrigin: true
},
'/foo': {
target: '<other_url>'
}
},
*/
before: function(app, server) {
if(NODE_ENV === 'development' && VUE_APP_MOCK === 'true') {
// parse app.body
// https://expressjs.com/en/4x/api.html#req.body
// create application/json parser
app.use(bodyParser.json());
// create application/x-www-form-urlencoded parser
app.use(bodyParser.urlencoded({ extended: false}));
mockServer(app);
}
}
},
css: {
loaderOptions: {
less: {
javascriptEnabled: true,
}
}
},
// 修改webpack的配置
configureWebpack: {
// 不需要打包的插件
externals: {
// 'vue': 'Vue',
// 'vue-router': 'VueRouter',
}
},
chainWebpack(config) {
// 内置的 svg Rule 添加 exclude
config.module
.rule('svg')
.exclude.add(/iconsvg/)
.end();
// 添加 svg-sprite-loader Rule
config.module
.rule('svg-sprite-loader')
.test(/.svg$/)
.include.add(/iconsvg/)
.end()
.use('svg-sprite-loader')
.loader('svg-sprite-loader');
// 添加 svgo Rule
config.module
.rule('svgo')
.test(/.svg$/)
.include.add(/iconsvg/)
.end()
.use('svgo-loader')
.loader('svgo-loader')
.options({
// externalConfig 配置特殊不是相对路径,起始路径是根目录
externalConfig: './src/assets/iconsvg/svgo.yml',
});
}
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
JavaScript
1
https://gitee.com/caicaizai/admin-antd-vue.git
git@gitee.com:caicaizai/admin-antd-vue.git
caicaizai
admin-antd-vue
admin-antd-vue
main

搜索帮助

344bd9b3 5694891 D2dac590 5694891