11const path = require ( 'path' ) ;
2- const webpack = require ( 'webpack' ) ;
32const ProgressBarPlugin = require ( 'progress-bar-webpack-plugin' ) ;
3+ const VueLoaderPlugin = require ( 'vue-loader/lib/plugin' ) ;
44
55const Components = require ( '../components.json' ) ;
66const config = require ( './config' ) ;
77
88const webpackConfig = {
9+ mode : 'production' ,
910 entry : Components ,
1011 output : {
1112 path : path . resolve ( process . cwd ( ) , './lib' ) ,
@@ -20,6 +21,13 @@ const webpackConfig = {
2021 modules : [ 'node_modules' ]
2122 } ,
2223 externals : config . externals ,
24+ performance : {
25+ hints : false
26+ } ,
27+ stats : 'none' ,
28+ optimization : {
29+ minimize : false
30+ } ,
2331 module : {
2432 rules : [
2533 {
@@ -32,13 +40,11 @@ const webpackConfig = {
3240 test : / \. v u e $ / ,
3341 loader : 'vue-loader' ,
3442 options : {
35- preserveWhitespace : false
43+ compilerOptions : {
44+ preserveWhitespace : false
45+ }
3646 }
3747 } ,
38- {
39- test : / \. j s o n $ / ,
40- loader : 'json-loader'
41- } ,
4248 {
4349 test : / \. c s s $ / ,
4450 loaders : [ 'style-loader' , 'css-loader' , 'postcss-loader' ]
@@ -48,27 +54,7 @@ const webpackConfig = {
4854 loaders : [ 'style-loader' , 'css-loader' , 'sass-loader' ]
4955 } ,
5056 {
51- test : / \. h t m l $ / ,
52- loader : 'html-loader?minimize=false'
53- } ,
54- {
55- test : / \. o t f | t t f | w o f f 2 ? | e o t ( \? \S * ) ? $ / ,
56- loader : 'url-loader' ,
57- query : {
58- limit : 10000 ,
59- name : path . posix . join ( 'static' , '[name].[hash:7].[ext]' )
60- }
61- } ,
62- {
63- test : / \. s v g ( \? \S * ) ? $ / ,
64- loader : 'url-loader' ,
65- query : {
66- limit : 10000 ,
67- name : path . posix . join ( 'static' , '[name].[hash:7].[ext]' )
68- }
69- } ,
70- {
71- test : / \. ( g i f | p n g | j p e ? g ) ( \? \S * ) ? $ / ,
57+ test : / \. ( s v g | o t f | t t f | w o f f 2 ? | e o t | g i f | p n g | j p e ? g ) ( \? \S * ) ? $ / ,
7258 loader : 'url-loader' ,
7359 query : {
7460 limit : 10000 ,
@@ -79,12 +65,7 @@ const webpackConfig = {
7965 } ,
8066 plugins : [
8167 new ProgressBarPlugin ( ) ,
82- new webpack . DefinePlugin ( {
83- 'process.env.NODE_ENV' : JSON . stringify ( 'production' )
84- } ) ,
85- new webpack . LoaderOptionsPlugin ( {
86- minimize : true
87- } )
68+ new VueLoaderPlugin ( )
8869 ]
8970} ;
9071
0 commit comments