aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/config
diff options
context:
space:
mode:
Diffstat (limited to 'client/config')
-rw-r--r--client/config/webpack.common.js67
-rw-r--r--client/config/webpack.dev.js3
-rw-r--r--client/config/webpack.prod.js45
3 files changed, 50 insertions, 65 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 }),
diff --git a/client/config/webpack.dev.js b/client/config/webpack.dev.js
index 5e0f36d7f..03d6d2fba 100644
--- a/client/config/webpack.dev.js
+++ b/client/config/webpack.dev.js
@@ -233,8 +233,7 @@ module.exports = function (env) {
233 host: METADATA.host, 233 host: METADATA.host,
234 historyApiFallback: true, 234 historyApiFallback: true,
235 watchOptions: { 235 watchOptions: {
236 aggregateTimeout: 300, 236 ignored: /node_modules/
237 poll: 1000
238 }, 237 },
239 outputPath: helpers.root('dist') 238 outputPath: helpers.root('dist')
240 }, 239 },
diff --git a/client/config/webpack.prod.js b/client/config/webpack.prod.js
index 6d65fcb37..9bb7306af 100644
--- a/client/config/webpack.prod.js
+++ b/client/config/webpack.prod.js
@@ -14,7 +14,7 @@ const LoaderOptionsPlugin = require('webpack/lib/LoaderOptionsPlugin')
14const NormalModuleReplacementPlugin = require('webpack/lib/NormalModuleReplacementPlugin') 14const NormalModuleReplacementPlugin = require('webpack/lib/NormalModuleReplacementPlugin')
15const OptimizeJsPlugin = require('optimize-js-plugin') 15const OptimizeJsPlugin = require('optimize-js-plugin')
16const UglifyJsPlugin = require('webpack/lib/optimize/UglifyJsPlugin') 16const UglifyJsPlugin = require('webpack/lib/optimize/UglifyJsPlugin')
17const WebpackMd5Hash = require('webpack-md5-hash') 17const HashedModuleIdsPlugin = require('webpack/lib/HashedModuleIdsPlugin')
18 18
19/** 19/**
20 * Webpack Constants 20 * Webpack Constants
@@ -67,7 +67,7 @@ module.exports = function (env) {
67 * 67 *
68 * See: http://webpack.github.io/docs/configuration.html#output-sourcemapfilename 68 * See: http://webpack.github.io/docs/configuration.html#output-sourcemapfilename
69 */ 69 */
70 sourceMapFilename: '[name].[chunkhash].bundle.map', 70 sourceMapFilename: '[file].map',
71 71
72 /** 72 /**
73 * The filename of non-entry chunks as relative path 73 * The filename of non-entry chunks as relative path
@@ -75,7 +75,7 @@ module.exports = function (env) {
75 * 75 *
76 * See: http://webpack.github.io/docs/configuration.html#output-chunkfilename 76 * See: http://webpack.github.io/docs/configuration.html#output-chunkfilename
77 */ 77 */
78 chunkFilename: '[id].[chunkhash].chunk.js', 78 chunkFilename: '[name].[chunkhash].chunk.js',
79 79
80 publicPath: '/client/' 80 publicPath: '/client/'
81 }, 81 },
@@ -92,14 +92,6 @@ module.exports = function (env) {
92 plugins: [ 92 plugins: [
93 93
94 /** 94 /**
95 * Plugin: WebpackMd5Hash
96 * Description: Plugin to replace a standard webpack chunkhash with md5.
97 *
98 * See: https://www.npmjs.com/package/webpack-md5-hash
99 */
100 new WebpackMd5Hash(),
101
102 /**
103 * Webpack plugin to optimize a JavaScript file for faster initial load 95 * Webpack plugin to optimize a JavaScript file for faster initial load
104 * by wrapping eagerly-invoked functions. 96 * by wrapping eagerly-invoked functions.
105 * 97 *
@@ -194,35 +186,7 @@ module.exports = function (env) {
194 helpers.root('config/empty.js') 186 helpers.root('config/empty.js')
195 ), 187 ),
196 188
197 // AoT 189 new HashedModuleIdsPlugin(),
198 // new NormalModuleReplacementPlugin(
199 // /@angular(\\|\/)upgrade/,
200 // helpers.root('config/empty.js')
201 // ),
202 // new NormalModuleReplacementPlugin(
203 // /@angular(\\|\/)compiler/,
204 // helpers.root('config/empty.js')
205 // ),
206 // new NormalModuleReplacementPlugin(
207 // /@angular(\\|\/)platform-browser-dynamic/,
208 // helpers.root('config/empty.js')
209 // ),
210 // new NormalModuleReplacementPlugin(
211 // /dom(\\|\/)debug(\\|\/)ng_probe/,
212 // helpers.root('config/empty.js')
213 // ),
214 // new NormalModuleReplacementPlugin(
215 // /dom(\\|\/)debug(\\|\/)by/,
216 // helpers.root('config/empty.js')
217 // ),
218 // new NormalModuleReplacementPlugin(
219 // /src(\\|\/)debug(\\|\/)debug_node/,
220 // helpers.root('config/empty.js')
221 // ),
222 // new NormalModuleReplacementPlugin(
223 // /src(\\|\/)debug(\\|\/)debug_renderer/,
224 // helpers.root('config/empty.js')
225 // ),
226 190
227 /** 191 /**
228 * Plugin: IgnorePlugin 192 * Plugin: IgnorePlugin
@@ -252,6 +216,7 @@ module.exports = function (env) {
252 * See: https://gist.github.com/sokra/27b24881210b56bbaff7 216 * See: https://gist.github.com/sokra/27b24881210b56bbaff7
253 */ 217 */
254 new LoaderOptionsPlugin({ 218 new LoaderOptionsPlugin({
219 minimize: true,
255 debug: false, 220 debug: false,
256 options: { 221 options: {
257 222