1 Star 0 Fork 66

舒朝昆 / springboot-xn-vue

forked from blowfish / springboot-xn-vue 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
vue.config.js 2.92 KB
一键复制 编辑 原始数据 按行查看 历史
blowfish 提交于 2019-06-25 13:59 . 首次提交
// Explanation of each configuration item You can find it in https://cli.vuejs.org/config/
const path = require('path')
function resolve(dir) {
return path.join(__dirname, './', dir)
}
module.exports = {
/**
* You can set by yourself according to actual condition
* You will need to set this if you plan to deploy your site under a sub path,
* for example GitHub pages. If you plan to deploy your site to https://foo.github.io/bar/,
* then assetsPublicPath should be set to "/bar/".
* In most cases please use '/' !!!
* Detail https://cli.vuejs.org/config/#baseurl
*/
baseUrl: '/',
outputDir: 'dist',
assetsDir: 'static',
lintOnSave: process.env.NODE_ENV !== 'production',
productionSourceMap: false,
devServer: {
port: 9528,
open: true,
overlay: {
warnings: false,
errors: true
},
proxy: {
'/': {
target: 'http://127.0.0.1:8080',
changeOrigin: true,
ws: false,
pathRewrite: {
'^/': ''
}
}
}
},
configureWebpack: {
// We 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: 'vue-admin-template',
resolve: {
alias: {
'@': resolve('src')
}
}
},
chainWebpack: config => {
config.plugins.delete('preload')
config.plugins.delete('prefetch')
config.module
.rule('svg')
.exclude.add(resolve('src/icons'))
.end()
config.module
.rule('icons')
.test(/\.svg$/)
.include.add(resolve('src/icons'))
.end()
.use('svg-sprite-loader')
.loader('svg-sprite-loader')
.options({
symbolId: 'icon-[name]'
})
.end()
config
.when(process.env.NODE_ENV === 'development',
config => config.devtool('cheap-source-map')
)
config
.when(process.env.NODE_ENV !== 'development',
config => {
config
.plugin('ScriptExtHtmlWebpackPlugin')
.use('script-ext-html-webpack-plugin', [{
// `runtime` must same as runtimeChunk name. default is `runtime`
inline: /runtime\..*\.js$/
}])
config
.optimization.splitChunks({
chunks: 'all',
cacheGroups: {
libs: {
name: 'chunk-libs',
test: /[\\/]node_modules[\\/]/,
priority: 10,
chunks: 'initial' // 只打包初始时依赖的第三方
},
elementUI: {
name: 'chunk-elementUI', // 单独将 elementUI 拆包
priority: 20, // 权重要大于 libs 和 app 不然会被打包进 libs 或者 app
test: /[\\/]node_modules[\\/]element-ui[\\/]/
}
}
})
config.optimization.runtimeChunk('single')
}
)
}
}
1
https://gitee.com/lzene/springboot-xn-vue.git
git@gitee.com:lzene/springboot-xn-vue.git
lzene
springboot-xn-vue
springboot-xn-vue
master

搜索帮助