init
This commit is contained in:
57
vue.config.js
Normal file
57
vue.config.js
Normal file
@@ -0,0 +1,57 @@
|
||||
const path = require('path')
|
||||
|
||||
const resolve = dir => {
|
||||
return path.join(__dirname, dir)
|
||||
}
|
||||
|
||||
// 项目部署基础
|
||||
const BASE_URL = process.env.NODE_ENV === 'development' ? '/' : '/'
|
||||
|
||||
const sourceMap = process.env.NODE_ENV === 'development'
|
||||
|
||||
module.exports = {
|
||||
publicPath: BASE_URL,
|
||||
// 如果你不需要使用eslint,把lintOnSave设为false即可
|
||||
lintOnSave: false,
|
||||
chainWebpack: config => {
|
||||
config.resolve.alias.set('@', resolve('src'))
|
||||
config.resolve.alias.set('_c', resolve('src/components'))
|
||||
|
||||
|
||||
|
||||
|
||||
const imagesRule = config.module.rule("images")
|
||||
|
||||
imagesRule
|
||||
.use('image-webpack-loader')
|
||||
.loader('image-webpack-loader')
|
||||
.options({
|
||||
bypassOnDebug: true,
|
||||
mozjpeg: {
|
||||
progressive: true,
|
||||
},
|
||||
optipng: {
|
||||
enabled: false,
|
||||
},
|
||||
pngquant: {
|
||||
quality: [0.7, 0.8],
|
||||
speed: 5
|
||||
},
|
||||
gifsicle: {
|
||||
interlaced: false,
|
||||
},
|
||||
webp: {
|
||||
quality: 90
|
||||
}
|
||||
}).end()
|
||||
|
||||
},
|
||||
|
||||
configureWebpack: {
|
||||
output: {
|
||||
filename: 'js/[hash].js'
|
||||
}
|
||||
},
|
||||
// 设为false打包时不生成.map文件
|
||||
productionSourceMap: sourceMap
|
||||
}
|
||||
Reference in New Issue
Block a user