5 Star 8 Fork 2

chenroaming/Vue3-element-template

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
vue.config.js 1.87 KB
一键复制 编辑 原始数据 按行查看 历史
'use strict'
const path = require('path')
const port = process.env.port || process.env.npm_config_port || 80 // dev port
function resolve (dir) {
return path.join(__dirname, dir)
}
const name = 'vue3 ElementPlus Template'
const apiPath = 'http://api.fund.eastmoney.com'
module.exports = {
publicPath: '/',
assetsDir: 'static',
// 在开发模式下开启保存时eslint格式化
lintOnSave: process.env.NODE_ENV === 'development',
// 生产环境下不展示源码
productionSourceMap: false,
devServer: {
host: 'localhost',
port: port,
open: true,
overlay: {
warnings: false,
errors: true
},
proxy: {
'/api': {
target: apiPath,
changeOrigin: true,
pathRewrite: {
'^/api': ''
}
}
}
},
configureWebpack: {
// provide the app's title in webpack's name field, so that
// it can be accessed in index.html to inject the correct title.
name: name,
resolve: {
alias: {
'@': resolve('src'),
_vi: resolve('src/views'),
_ut: resolve('src/utils')
}
}
},
chainWebpack: config => {
// 分类打包配置
config.optimization.splitChunks({
chunks: 'all',
cacheGroups: {
libs: {
name: 'chunk-libs',
test: /[\\/]node_modules[\\/]/,
priority: 10,
chunks: 'initial' // only package third parties that are initially dependent
},
elementUI: {
name: 'chunk-element-plus', // split elementUI into a single package
priority: 20, // the weight needs to be larger than libs and app or it will be packaged into libs or app
test: /[\\/]node_modules[\\/]_?element-plus(.*)/ // in order to adapt to cnpm
}
}
})
config
.plugin('webpack-bundle-analyzer')
.use(require('webpack-bundle-analyzer').BundleAnalyzerPlugin)
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
JavaScript
1
https://gitee.com/chenroaming/vue3-element-template.git
git@gitee.com:chenroaming/vue3-element-template.git
chenroaming
vue3-element-template
Vue3-element-template
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385