aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/config/webpack.common.js
diff options
context:
space:
mode:
Diffstat (limited to 'client/config/webpack.common.js')
-rw-r--r--client/config/webpack.common.js67
1 files changed, 44 insertions, 23 deletions
diff --git a/client/config/webpack.common.js b/client/config/webpack.common.js
index 6067d94e7..266e630f6 100644
--- a/client/config/webpack.common.js
+++ b/client/config/webpack.common.js
@@ -85,23 +85,37 @@ module.exports = function (options) {
85 rules: [ 85 rules: [
86 86
87 /* 87 /*
88 * Typescript loader support for .ts and Angular 2 async routes via .async.ts 88 * Typescript loader support for .ts and Angular async routes via .async.ts
89 * 89 *
90 * See: https://github.com/s-panferov/awesome-typescript-loader 90 * See: https://github.com/s-panferov/awesome-typescript-loader
91 */ 91 */
92 { 92 {
93 test: /\.ts$/, 93 test: /\.ts$/,
94 use: [ 94 use: [
95 '@angularclass/hmr-loader?pretty=' + !isProd + '&prod=' + isProd, 95 {
96 'awesome-typescript-loader?{configFileName: "tsconfig.webpack.json"}', 96 loader: '@angularclass/hmr-loader',
97 'angular2-template-loader', 97 options: {
98 pretty: !isProd,
99 prod: isProd
100 }
101 },
98 { 102 {
99 loader: 'ng-router-loader', 103 loader: 'ng-router-loader',
100 options: { 104 options: {
101 loader: 'async-system', 105 loader: 'async-import',
102 genDir: 'compiled', 106 genDir: 'compiled',
103 aot: AOT 107 aot: AOT
104 } 108 }
109 },
110 {
111 loader: 'awesome-typescript-loader',
112 options: {
113 configFileName: 'tsconfig.webpack.json',
114 useCache: !isProd
115 }
116 },
117 {
118 loader: 'angular2-template-loader'
105 } 119 }
106 ], 120 ],
107 exclude: [/\.(spec|e2e)\.ts$/] 121 exclude: [/\.(spec|e2e)\.ts$/]
@@ -114,7 +128,7 @@ module.exports = function (options) {
114 */ 128 */
115 { 129 {
116 test: /\.json$/, 130 test: /\.json$/,
117 loader: 'json-loader' 131 use: 'json-loader'
118 }, 132 },
119 133
120 { 134 {
@@ -149,7 +163,7 @@ module.exports = function (options) {
149 */ 163 */
150 { 164 {
151 test: /\.html$/, 165 test: /\.html$/,
152 loader: 'raw-loader', 166 use: 'raw-loader',
153 exclude: [ 167 exclude: [
154 helpers.root('src/index.html'), 168 helpers.root('src/index.html'),
155 helpers.root('src/standalone/videos/embed.html') 169 helpers.root('src/standalone/videos/embed.html')
@@ -213,11 +227,15 @@ module.exports = function (options) {
213 * See: https://github.com/angular/angular/issues/11580 227 * See: https://github.com/angular/angular/issues/11580
214 */ 228 */
215 new ContextReplacementPlugin( 229 new ContextReplacementPlugin(
216 // The (\\|\/) piece accounts for path separators in *nix and Windows 230 /**
217 /angular(\\|\/)core(\\|\/)src(\\|\/)linker/, 231 * The (\\|\/) piece accounts for path separators in *nix and Windows
232 */
233 /angular(\\|\/)core(\\|\/)@angular/,
218 helpers.root('src'), // location of your src 234 helpers.root('src'), // location of your src
219 { 235 {
220 // your Angular Async Route paths relative to this root directory 236 /**
237 * Your Angular Async Route paths relative to this root directory
238 */
221 } 239 }
222 ), 240 ),
223 241
@@ -246,6 +264,20 @@ module.exports = function (options) {
246 ]), 264 ]),
247 265
248 /* 266 /*
267 * Plugin: ScriptExtHtmlWebpackPlugin
268 * Description: Enhances html-webpack-plugin functionality
269 * with different deployment options for your scripts including:
270 *
271 * See: https://github.com/numical/script-ext-html-webpack-plugin
272 */
273 new ScriptExtHtmlWebpackPlugin({
274 sync: [ /polyfill|vendor/, 'webtorrent.min.js' ],
275 defaultAttribute: 'async',
276 preload: [/polyfill|vendor|main/],
277 prefetch: [/chunk/]
278 }),
279
280 /*
249 * Plugin: HtmlWebpackPlugin 281 * Plugin: HtmlWebpackPlugin
250 * Description: Simplifies creation of HTML files to serve your webpack bundles. 282 * Description: Simplifies creation of HTML files to serve your webpack bundles.
251 * This is especially useful for webpack bundles that include a hash in the filename 283 * This is especially useful for webpack bundles that include a hash in the filename
@@ -257,19 +289,8 @@ module.exports = function (options) {
257 template: 'src/index.html', 289 template: 'src/index.html',
258 title: METADATA.title, 290 title: METADATA.title,
259 chunksSortMode: 'dependency', 291 chunksSortMode: 'dependency',
260 metadata: METADATA 292 metadata: METADATA,
261 }), 293 inject: 'body'
262
263 /*
264 * Plugin: ScriptExtHtmlWebpackPlugin
265 * Description: Enhances html-webpack-plugin functionality
266 * with different deployment options for your scripts including:
267 *
268 * See: https://github.com/numical/script-ext-html-webpack-plugin
269 */
270 new ScriptExtHtmlWebpackPlugin({
271 sync: [ 'webtorrent.min.js' ],
272 defaultAttribute: 'defer'
273 }), 294 }),
274 295
275 new WebpackNotifierPlugin({ alwaysNotify: true }), 296 new WebpackNotifierPlugin({ alwaysNotify: true }),