1 Star 4 Fork 0

刘智雄/carAnalysisFrontEnd

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
vue.config.js 2.75 KB
一键复制 编辑 原始数据 按行查看 历史
刘智雄 提交于 2022-09-05 22:38 . fix: fix some bug for run
const path = require("path");
function resolve(dir) {
return path.join(__dirname, dir);
}
const name = '汽车数据分析平台'
module.exports = {
configureWebpack: {
name: name,
resolve: {
alias: {
"@": resolve("src"),
"~": resolve("node_modules")
},
},
},
devServer: {
port: 8080,
open: true,
proxy: {
// detail: https://cli.vuejs.org/config/#devserver-proxy
'/api': {
target: `http://42.193.254.225:8000`,
changeOrigin: true,
pathRewrite: {
'^/api': ''
}
}
},
disableHostCheck: true
},
chainWebpack(config) {
config.plugins.delete('preload') // TODO: need test
config.plugins.delete('prefetch') // TODO: need test
// set svg-sprite-loader
config.module
.rule('svg')
.exclude.add(resolve('src/assets/icons'))
.end()
config.module
.rule('icons')
.test(/\.svg$/)
.include.add(resolve('src/assets/icons'))
.end()
.use('svg-sprite-loader')
.loader('svg-sprite-loader')
.options({
symbolId: 'icon-[name]'
})
.end()
config
.when(process.env.NODE_ENV !== 'development',
config => {
config
.plugin('ScriptExtHtmlWebpackPlugin')
.after('html')
.use('script-ext-html-webpack-plugin', [{
// `runtime` must same as runtimeChunk name. default is `runtime`
inline: /runtime\..*\.js$/
}])
.end()
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-elementUI', // 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-ui(.*)/ // in order to adapt to cnpm
},
commons: {
name: 'chunk-commons',
test: resolve('src/components'), // can customize your rules
minChunks: 3, // minimum common number
priority: 5,
reuseExistingChunk: true
}
}
})
config.optimization.runtimeChunk('single'),
{
from: path.resolve(__dirname, './public/robots.txt'), //防爬虫文件
to: './', //到根目录下
}
}
)
}
};
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/liu_zhi_xiong258/car-analysis-front-end.git
git@gitee.com:liu_zhi_xiong258/car-analysis-front-end.git
liu_zhi_xiong258
car-analysis-front-end
carAnalysisFrontEnd
master

搜索帮助

23e8dbc6 1850385 7e0993f3 1850385