删除不必要的图片
This commit is contained in:
@@ -1,57 +1,43 @@
|
||||
const path = require('path')
|
||||
const path = require("path");
|
||||
|
||||
const resolve = dir => {
|
||||
return path.join(__dirname, dir)
|
||||
}
|
||||
const resolve = (dir) => {
|
||||
return path.join(__dirname, dir);
|
||||
};
|
||||
|
||||
// 项目部署基础
|
||||
const BASE_URL = process.env.NODE_ENV === 'development' ? '/' : '/'
|
||||
const BASE_URL = process.env.NODE_ENV === "development" ? "/" : "/";
|
||||
|
||||
const sourceMap = process.env.NODE_ENV === 'development'
|
||||
const sourceMap = process.env.NODE_ENV === "development";
|
||||
|
||||
module.exports = {
|
||||
publicPath: BASE_URL,
|
||||
baseUrl : BASE_URL,
|
||||
// 如果你不需要使用eslint,把lintOnSave设为false即可
|
||||
lintOnSave: false,
|
||||
chainWebpack: config => {
|
||||
config.resolve.alias.set('@', resolve('src'))
|
||||
config.resolve.alias.set('_c', resolve('src/components'))
|
||||
chainWebpack: (config) => {
|
||||
config.resolve.alias.set("@", resolve("src"));
|
||||
config.resolve.alias.set("_c", resolve("src/components"));
|
||||
|
||||
|
||||
|
||||
|
||||
const imagesRule = config.module.rule("images")
|
||||
|
||||
imagesRule
|
||||
config.module.rule('images')
|
||||
.test(/\.(png|jpe?g|gif|svg)(\?.*)?$/)
|
||||
.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()
|
||||
bypassOnDebug: true
|
||||
})
|
||||
|
||||
|
||||
|
||||
config.module.rule('images').use('url-loader').loader('url-loader').options(
|
||||
{ limit:2,esModule:false}
|
||||
)
|
||||
|
||||
},
|
||||
|
||||
configureWebpack: {
|
||||
output: {
|
||||
filename: 'js/[hash].js'
|
||||
}
|
||||
filename: "js/[hash].js",
|
||||
},
|
||||
},
|
||||
// 设为false打包时不生成.map文件
|
||||
productionSourceMap: sourceMap
|
||||
}
|
||||
productionSourceMap: sourceMap,
|
||||
};
|
||||
Reference in New Issue
Block a user