-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathvue.config.js
56 lines (50 loc) · 1.42 KB
/
vue.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
const ImageminPlugin = require('imagemin-webpack-plugin').default
const ImageminWebp = require('imagemin-webp-webpack-plugin')
const ImageminMozJpeg = require('imagemin-mozjpeg')
// const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin
module.exports = {
chainWebpack (config) {
// Remove existing SVG rule which uses file-loader
config.module.rules.delete('svg')
// Use our loader instead
config.module.rule('svg')
.test(/\.svg$/)
.use('vue')
.loader('vue-loader')
.end()
.use('svg-to-vue-component')
.loader('svg-to-vue-component/loader')
// clear the existing entry point
config
.entry('main')
.clear()
// add your custom entry point
config
.entry('main')
.add('./src/main.js')
config
.plugin('ImageminWebp')
.use(ImageminWebp, [{
test: /\.(jpg|png)$/i,
// disable: process.env.NODE_ENV !== 'production', // Disable during development
option: {
quality: 85
}
}])
config
.plugin('ImageminPlugin')
.use(ImageminPlugin, [{
test: /\.(jpg|png)$/i,
// disable: process.env.NODE_ENV !== 'production', // Disable during development
pngquant: {
quality: '100'
},
plugins: [
ImageminMozJpeg({
quality: 75,
progressive: true
})
]
}])
}
}