1
1
const path = require ( 'path' ) ;
2
- const webpack = require ( 'webpack' ) ;
3
2
const ProgressBarPlugin = require ( 'progress-bar-webpack-plugin' ) ;
3
+ const VueLoaderPlugin = require ( 'vue-loader/lib/plugin' ) ;
4
4
5
5
const Components = require ( '../components.json' ) ;
6
6
const config = require ( './config' ) ;
7
7
8
8
const webpackConfig = {
9
+ mode : 'production' ,
9
10
entry : Components ,
10
11
output : {
11
12
path : path . resolve ( process . cwd ( ) , './lib' ) ,
@@ -20,6 +21,13 @@ const webpackConfig = {
20
21
modules : [ 'node_modules' ]
21
22
} ,
22
23
externals : config . externals ,
24
+ performance : {
25
+ hints : false
26
+ } ,
27
+ stats : 'none' ,
28
+ optimization : {
29
+ minimize : false
30
+ } ,
23
31
module : {
24
32
rules : [
25
33
{
@@ -32,13 +40,11 @@ const webpackConfig = {
32
40
test : / \. v u e $ / ,
33
41
loader : 'vue-loader' ,
34
42
options : {
35
- preserveWhitespace : false
43
+ compilerOptions : {
44
+ preserveWhitespace : false
45
+ }
36
46
}
37
47
} ,
38
- {
39
- test : / \. j s o n $ / ,
40
- loader : 'json-loader'
41
- } ,
42
48
{
43
49
test : / \. c s s $ / ,
44
50
loaders : [ 'style-loader' , 'css-loader' , 'postcss-loader' ]
@@ -48,27 +54,7 @@ const webpackConfig = {
48
54
loaders : [ 'style-loader' , 'css-loader' , 'sass-loader' ]
49
55
} ,
50
56
{
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 * ) ? $ / ,
72
58
loader : 'url-loader' ,
73
59
query : {
74
60
limit : 10000 ,
@@ -79,12 +65,7 @@ const webpackConfig = {
79
65
} ,
80
66
plugins : [
81
67
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 ( )
88
69
]
89
70
} ;
90
71
0 commit comments