File tree 2 files changed +23
-32
lines changed
2 files changed +23
-32
lines changed Original file line number Diff line number Diff line change 1
- export default {
1
+ module . exports = {
2
2
input : 'src/index.js' ,
3
3
output : {
4
4
file : 'build/vue-html-to-paper.js' ,
5
5
name : 'VueHtmlToPaper' ,
6
- format : 'umd'
7
- }
6
+ format : 'umd' ,
7
+ } ,
8
8
} ;
Original file line number Diff line number Diff line change 1
- const path = require ( 'path' ) ;
2
- const webpack = require ( 'webpack' ) ;
1
+ var path = require ( 'path' ) ;
2
+ var TerserPlugin = require ( 'terser- webpack-plugin ' ) ;
3
3
var CompressionPlugin = require ( 'compression-webpack-plugin' ) ;
4
4
5
5
module . exports = {
6
+ mode : 'production' ,
6
7
entry : './src/index.js' ,
7
8
output : {
8
9
library : 'VueHtmlToPaper' ,
9
10
libraryTarget : 'commonjs2' ,
10
11
path : path . resolve ( __dirname , 'dist' ) ,
11
- filename : 'index.js'
12
+ filename : 'index.js' ,
12
13
} ,
13
14
module : {
14
15
rules : [
15
16
{
16
17
test : / \. c s s $ / ,
17
- loader : 'style-loader! css-loader!'
18
+ use : [ 'style-loader' , ' css-loader' ] ,
18
19
} ,
19
20
{
20
- test : / \. j s $ / ,
21
- exclude : / ( n o d e _ m o d u l e s ) / ,
21
+ test : / \. m ? j s $ / ,
22
+ exclude : / ( n o d e _ m o d u l e s | b o w e r _ c o m p o n e n t s ) / ,
22
23
use : {
23
24
loader : 'babel-loader' ,
24
25
options : {
25
- presets : [ 'env' ]
26
- }
27
- }
28
- }
29
- ]
26
+ presets : [ '@babel/preset- env' ] ,
27
+ } ,
28
+ } ,
29
+ } ,
30
+ ] ,
30
31
} ,
31
32
plugins : [
32
- new webpack . optimize . UglifyJsPlugin ( {
33
- mangle : true ,
34
- compress : {
35
- warnings : false , // Suppress uglification warnings
36
- pure_getters : true ,
37
- unsafe : true ,
38
- unsafe_comps : true ,
39
- screw_ie8 : true
40
- } ,
41
- output : {
42
- comments : false ,
43
- } ,
44
- exclude : [ / \. m i n \. j s $ / gi] // skip pre-minified libs
45
- } ) ,
46
33
new CompressionPlugin ( {
47
34
asset : "[path].gz[query]" ,
48
35
algorithm : "gzip" ,
49
36
test : / \. j s $ | \. c s s $ | \. h t m l $ / ,
50
37
threshold : 10240 ,
51
- minRatio : 0
52
- } )
53
- ]
54
- }
38
+ minRatio : 0 ,
39
+ } ) ,
40
+ ] ,
41
+ optimization : {
42
+ minimize : true ,
43
+ minimizer : [ new TerserPlugin ( ) ] ,
44
+ } ,
45
+ } ;
You can’t perform that action at this time.
0 commit comments