diff options
Diffstat (limited to 'client/config/webpack.common.js')
-rw-r--r-- | client/config/webpack.common.js | 37 |
1 files changed, 21 insertions, 16 deletions
diff --git a/client/config/webpack.common.js b/client/config/webpack.common.js index 000699aa5..83bcbc240 100644 --- a/client/config/webpack.common.js +++ b/client/config/webpack.common.js | |||
@@ -11,6 +11,7 @@ const CheckerPlugin = require('awesome-typescript-loader').CheckerPlugin | |||
11 | const HtmlWebpackPlugin = require('html-webpack-plugin') | 11 | const HtmlWebpackPlugin = require('html-webpack-plugin') |
12 | const LoaderOptionsPlugin = require('webpack/lib/LoaderOptionsPlugin') | 12 | const LoaderOptionsPlugin = require('webpack/lib/LoaderOptionsPlugin') |
13 | const ScriptExtHtmlWebpackPlugin = require('script-ext-html-webpack-plugin') | 13 | const ScriptExtHtmlWebpackPlugin = require('script-ext-html-webpack-plugin') |
14 | const InlineManifestWebpackPlugin = require('inline-manifest-webpack-plugin') | ||
14 | const ngcWebpack = require('ngc-webpack') | 15 | const ngcWebpack = require('ngc-webpack') |
15 | 16 | ||
16 | const WebpackNotifierPlugin = require('webpack-notifier') | 17 | const WebpackNotifierPlugin = require('webpack-notifier') |
@@ -216,7 +217,9 @@ module.exports = function (options) { | |||
216 | new CommonsChunkPlugin({ | 217 | new CommonsChunkPlugin({ |
217 | name: 'vendor', | 218 | name: 'vendor', |
218 | chunks: ['main'], | 219 | chunks: ['main'], |
219 | minChunks: module => /node_modules\//.test(module.resource) | 220 | minChunks: module => { |
221 | return /node_modules\//.test(module.resource) | ||
222 | } | ||
220 | }), | 223 | }), |
221 | 224 | ||
222 | // Specify the correct order the scripts will be injected in | 225 | // Specify the correct order the scripts will be injected in |
@@ -245,20 +248,6 @@ module.exports = function (options) { | |||
245 | ), | 248 | ), |
246 | 249 | ||
247 | /* | 250 | /* |
248 | * Plugin: ScriptExtHtmlWebpackPlugin | ||
249 | * Description: Enhances html-webpack-plugin functionality | ||
250 | * with different deployment options for your scripts including: | ||
251 | * | ||
252 | * See: https://github.com/numical/script-ext-html-webpack-plugin | ||
253 | */ | ||
254 | new ScriptExtHtmlWebpackPlugin({ | ||
255 | sync: [ /polyfill|vendor/ ], | ||
256 | defaultAttribute: 'async', | ||
257 | preload: [/polyfill|vendor|main/], | ||
258 | prefetch: [/chunk/] | ||
259 | }), | ||
260 | |||
261 | /* | ||
262 | * Plugin: HtmlWebpackPlugin | 251 | * Plugin: HtmlWebpackPlugin |
263 | * Description: Simplifies creation of HTML files to serve your webpack bundles. | 252 | * Description: Simplifies creation of HTML files to serve your webpack bundles. |
264 | * This is especially useful for webpack bundles that include a hash in the filename | 253 | * This is especially useful for webpack bundles that include a hash in the filename |
@@ -277,6 +266,20 @@ module.exports = function (options) { | |||
277 | inject: 'body' | 266 | inject: 'body' |
278 | }), | 267 | }), |
279 | 268 | ||
269 | /* | ||
270 | * Plugin: ScriptExtHtmlWebpackPlugin | ||
271 | * Description: Enhances html-webpack-plugin functionality | ||
272 | * with different deployment options for your scripts including: | ||
273 | * | ||
274 | * See: https://github.com/numical/script-ext-html-webpack-plugin | ||
275 | */ | ||
276 | new ScriptExtHtmlWebpackPlugin({ | ||
277 | sync: [ /polyfill|vendor/ ], | ||
278 | defaultAttribute: 'async', | ||
279 | preload: [/polyfill|vendor|main/], | ||
280 | prefetch: [/chunk/] | ||
281 | }), | ||
282 | |||
280 | new WebpackNotifierPlugin({ alwaysNotify: true }), | 283 | new WebpackNotifierPlugin({ alwaysNotify: true }), |
281 | 284 | ||
282 | /** | 285 | /** |
@@ -296,7 +299,9 @@ module.exports = function (options) { | |||
296 | new ngcWebpack.NgcWebpackPlugin({ | 299 | new ngcWebpack.NgcWebpackPlugin({ |
297 | disabled: !AOT, | 300 | disabled: !AOT, |
298 | tsConfig: helpers.root('tsconfig.webpack.json') | 301 | tsConfig: helpers.root('tsconfig.webpack.json') |
299 | }) | 302 | }), |
303 | |||
304 | new InlineManifestWebpackPlugin(), | ||
300 | ], | 305 | ], |
301 | 306 | ||
302 | /* | 307 | /* |