@@ -29,133 +29,67 @@ const sassDataExportPath = `${process.cwd()}/dist`;
29
29
const defaultConfig = {
30
30
// entry: './src/index.js',
31
31
entry : {
32
- 'critical-fonts' : './src/_patterns/02-components/bolt-critical-fonts/src/critical-fonts' ,
33
-
34
- // './src/components/bolt-icon/dist/icon': [
35
- // // './src/scripts/native-shim.js', //Wrapper for custom-elements-es5-adapter.js so this doesn't break in other browsers like IE11
36
- // // './node_modules/@webcomponents/webcomponentsjs/webcomponents-lite.js',
37
- // // './node_modules/@webcomponents/webcomponentsjs/webcomponents-sd-ce.js',
38
- // './src/components/bolt-icon/src/icon'
39
- // ],
40
- // './dist/scripts/bolt-icon': [
41
- // './node_modules/@webcomponents/webcomponentsjs/custom-elements-es5-adapter.js',
42
- // './node_modules/@webcomponents/webcomponentsjs/webcomponents-lite.js',
43
- // './src/components/bolt-icon/src/icon'
44
- // ],
45
-
46
- 'bolt-app' : [
47
- // './src/scripts/native-shim.js', //Wrapper for custom-elements-es5-adapter.js so this doesn't break in other browsers like IE11
48
- // './node_modules/@webcomponents/webcomponentsjs/webcomponents-lite.js',
49
- // './node_modules/@webcomponents/webcomponentsjs/webcomponents-sd-ce.js',
50
- './src/scripts/bolt-app'
51
- ] ,
52
- 'bolt-critical-path' : './src/scripts/bolt-critical-path' ,
32
+ 'critical-fonts' :
33
+ './src/_patterns/02-components/bolt-critical-fonts/src/critical-fonts' ,
34
+ 'bolt-app' : './src/scripts/bolt-app' ,
35
+ 'bolt-critical-path' : './src/scripts/bolt-critical-path'
53
36
} ,
54
37
output : {
55
38
path : `${ process . cwd ( ) } /dist/scripts/` ,
56
39
filename : '[name].min.js' ,
57
40
publicPath : `/scripts/` ,
58
- chunkFilename : `[id].chunk.js`
41
+ chunkFilename : `[name]-chunk.min.js` ,
42
+ libraryTarget : 'umd'
59
43
} ,
60
44
devtool : 'cheap-module-source-map' ,
61
45
// devtool: 'cheap-source-map',
62
46
resolve : {
63
47
// Help webpack find local Bolt code in the src folder
64
48
mainFields : [ 'module:dev' , 'browser' , 'module' , 'main' ] ,
65
49
alias : {
66
- styles : path . resolve ( __dirname , 'src/styles' ) ,
50
+ styles : path . resolve ( __dirname , 'src/styles' )
67
51
} ,
68
52
extensions : [ '.js' , '.jsx' , '.json' , '.svg' , '.scss' ]
69
53
} ,
70
54
71
-
72
55
module : {
73
56
rules : [
74
- // {
75
- // test: /node_modules\/skatejs\/**\/*\.js?$/,
76
- // // include: /skatejs/,
77
- // // exclude: /!node_modules\/skatejs/,
78
- // use: ['awesome-typescript-loader']
79
- // },webpack:///
80
57
{
81
58
test : / \. j s $ / ,
82
- // exclude: /\.es6.js$/,
83
59
exclude : / ( n o d e _ m o d u l e s \/ @ s k a t e j s \/ r e n d e r e r - l i t - h t m l \/ d i s t \/ n o d e \/ i n d e x \. j s | n a t i v e - s h i m \. j s | n o d e _ m o d u l e s \/ \@ w e b c o m p o n e n t s \/ w e b c o m p o n e n t s j s \/ c u s t o m - e l e m e n t s - e s 5 - a d a p t e r \. j s | \@ w e b c o m p o n e n t s \/ w e b c o m p o n e n t s j s \/ c u s t o m - e l e m e n t s - e s 5 - a d a p t e r \. j s | c u s t o m - e l e m e n t s - e s 5 - a d a p t e r \. j s | b o w e r _ c o m p o n e n t s ) / ,
84
60
use : {
85
61
loader : 'babel-loader' ,
86
62
options : {
87
63
babelrc : false ,
88
64
plugins : [
89
-
90
- // [
91
- // 'jsx-pragmatic',
92
- // {
93
- // module: 'preact',
94
- // export: 'h',
95
- // import: 'h'
96
- // }
97
- // ],
98
65
[
99
66
'transform-react-jsx' ,
100
67
{
101
68
pragma : 'h'
102
69
}
103
70
] ,
104
- "transform-decorators-legacy"
105
- // ['module-resolver',
106
- // {
107
- // root: [
108
- // './src'
109
- // ],
110
- // alias: {
111
- // h: 'preact'
112
- // }
113
- // }
114
- // ],
115
- // 'transform-class-properties',
116
- // 'transform-custom-element-classes',
117
- // 'transform-es2015-classes',
118
- // 'transform-object-assign',
119
- // 'transform-object-rest-spread',
120
- // 'inline-react-svg'
71
+ 'transform-decorators-legacy'
121
72
] ,
122
73
123
74
presets : [
124
75
[
125
- " env" ,
76
+ ' env' ,
126
77
{
127
78
targets : {
128
79
// browsers: [
129
80
// 'last 3 versions',
130
81
// 'not ie < 9'
131
82
// ]
132
83
} ,
133
- " modules" : false
84
+ modules : false
134
85
}
135
86
] ,
136
- "flow" ,
137
- "react" ,
138
- "es2015" ,
139
- "es2016" ,
140
- "es2017" ,
141
- "stage-0" ,
142
- // ['env', {
143
- // targets: {
144
- // browsers: [
145
- // 'last 3 versions',
146
- // 'not ie < 9'
147
- // ]
148
- // },
149
- // debug: false
150
- // }],
151
- // "react",
152
- // "es2016",
153
- // "es2017",
154
- // // "flow",
155
- // "react",
156
- // "stage-0"
157
- // 'stage-0'
158
- // "flow",
87
+ 'flow' ,
88
+ 'react' ,
89
+ 'es2015' ,
90
+ 'es2016' ,
91
+ 'es2017' ,
92
+ 'stage-0'
159
93
]
160
94
}
161
95
}
@@ -165,21 +99,13 @@ const defaultConfig = {
165
99
exclude : / \. s c o p e d .s c s s $ / ,
166
100
use : [
167
101
{
168
- loader : 'css-loader' ,
169
- // options: {
170
- // sourceMap: true,
171
- // modules: true,
172
- // importLoaders: true,
173
- // localIdentName: '[name]__[local]___[hash:base64:5]'
174
- // }
102
+ loader : 'css-loader'
175
103
} ,
176
104
{
177
105
loader : 'postcss-loader' ,
178
106
options : {
179
- plugins : function ( ) {
180
- return [
181
- require ( 'autoprefixer' )
182
- ] ;
107
+ plugins : function ( ) {
108
+ return [ require ( 'autoprefixer' ) ] ;
183
109
}
184
110
}
185
111
} ,
@@ -220,10 +146,8 @@ const defaultConfig = {
220
146
{
221
147
loader : 'postcss-loader' ,
222
148
options : {
223
- plugins : function ( ) {
224
- return [
225
- require ( 'autoprefixer' )
226
- ] ;
149
+ plugins : function ( ) {
150
+ return [ require ( 'autoprefixer' ) ] ;
227
151
}
228
152
}
229
153
} ,
@@ -263,20 +187,11 @@ const defaultConfig = {
263
187
maxEntrypointSize : 1500000
264
188
} ,
265
189
plugins : [
266
- new webpack . optimize . CommonsChunkPlugin ( {
267
- // name: "app",
268
- // or
269
- // names: ["app", "subPageA"],
270
- // the name or list of names must match the name or names
271
- // of the entry points that create the async chunks
190
+ new CommonsChunkPlugin ( {
191
+ deepChildren : true ,
272
192
children : true ,
273
- // (use all children of the chunk)
274
-
275
- async : true ,
276
- // (create an async commons chunk)
277
-
278
- minChunks : 2 ,
279
- // (3 children must share the module before it's separated)
193
+ minChunks : Infinity ,
194
+ async : true
280
195
} ) ,
281
196
new webpack . IgnorePlugin ( / v e r t x / ) , // needed to ignore vertx dependency in webcomponentsjs-lite
282
197
new ExtractTextPlugin ( {
@@ -313,7 +228,7 @@ const defaultConfig = {
313
228
} ;
314
229
315
230
316
-
231
+
317
232
318
233
319
234
0 commit comments