aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/config/webpack.common.js
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-10-09 14:28:44 +0200
committerChocobozzz <florian.bigard@gmail.com>2017-10-09 14:28:44 +0200
commita685e25ca05f08ad1b3f7fbaccc8744727bd8d27 (patch)
treee50fbc2f260a0017113c4668c3c0f3d2fd76ab87 /client/config/webpack.common.js
parent2ed6a0aedc2d2f6b1ac2fd9a1ac137772831f713 (diff)
downloadPeerTube-a685e25ca05f08ad1b3f7fbaccc8744727bd8d27.tar.gz
PeerTube-a685e25ca05f08ad1b3f7fbaccc8744727bd8d27.tar.zst
PeerTube-a685e25ca05f08ad1b3f7fbaccc8744727bd8d27.zip
Try to optimize frontend
Diffstat (limited to 'client/config/webpack.common.js')
-rw-r--r--client/config/webpack.common.js37
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
11const HtmlWebpackPlugin = require('html-webpack-plugin') 11const HtmlWebpackPlugin = require('html-webpack-plugin')
12const LoaderOptionsPlugin = require('webpack/lib/LoaderOptionsPlugin') 12const LoaderOptionsPlugin = require('webpack/lib/LoaderOptionsPlugin')
13const ScriptExtHtmlWebpackPlugin = require('script-ext-html-webpack-plugin') 13const ScriptExtHtmlWebpackPlugin = require('script-ext-html-webpack-plugin')
14const InlineManifestWebpackPlugin = require('inline-manifest-webpack-plugin')
14const ngcWebpack = require('ngc-webpack') 15const ngcWebpack = require('ngc-webpack')
15 16
16const WebpackNotifierPlugin = require('webpack-notifier') 17const 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 /*