diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2016-10-02 15:39:09 +0200 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2016-10-02 15:39:09 +0200 |
commit | a6375e69668ea42e19531c6bc68dcd37f3f7cbd7 (patch) | |
tree | 03204a408d56311692c3528bedcf95d2455e94f2 /client/config | |
parent | 052937db8a8d282eccdbdf38d487ed8d85d3c0a7 (diff) | |
parent | c4403b29ad4db097af528a7f04eea07e0ed320d0 (diff) | |
download | PeerTube-a6375e69668ea42e19531c6bc68dcd37f3f7cbd7.tar.gz PeerTube-a6375e69668ea42e19531c6bc68dcd37f3f7cbd7.tar.zst PeerTube-a6375e69668ea42e19531c6bc68dcd37f3f7cbd7.zip |
Merge branch 'master' into webseed-merged
Diffstat (limited to 'client/config')
-rw-r--r-- | client/config/helpers.js | 5 | ||||
-rw-r--r-- | client/config/webpack.common.js | 399 | ||||
-rw-r--r-- | client/config/webpack.dev.js | 218 | ||||
-rw-r--r-- | client/config/webpack.prod.js | 357 |
4 files changed, 501 insertions, 478 deletions
diff --git a/client/config/helpers.js b/client/config/helpers.js index 24d7dae9f..6268d2628 100644 --- a/client/config/helpers.js +++ b/client/config/helpers.js | |||
@@ -8,10 +8,15 @@ function hasProcessFlag (flag) { | |||
8 | return process.argv.join('').indexOf(flag) > -1 | 8 | return process.argv.join('').indexOf(flag) > -1 |
9 | } | 9 | } |
10 | 10 | ||
11 | function isWebpackDevServer () { | ||
12 | return process.argv[1] && !!(/webpack-dev-server$/.exec(process.argv[1])) | ||
13 | } | ||
14 | |||
11 | function root (args) { | 15 | function root (args) { |
12 | args = Array.prototype.slice.call(arguments, 0) | 16 | args = Array.prototype.slice.call(arguments, 0) |
13 | return path.join.apply(path, [ROOT].concat(args)) | 17 | return path.join.apply(path, [ROOT].concat(args)) |
14 | } | 18 | } |
15 | 19 | ||
16 | exports.hasProcessFlag = hasProcessFlag | 20 | exports.hasProcessFlag = hasProcessFlag |
21 | exports.isWebpackDevServer = isWebpackDevServer | ||
17 | exports.root = root | 22 | exports.root = root |
diff --git a/client/config/webpack.common.js b/client/config/webpack.common.js index 2ff3a1506..882013a9e 100644 --- a/client/config/webpack.common.js +++ b/client/config/webpack.common.js | |||
@@ -5,9 +5,11 @@ const helpers = require('./helpers') | |||
5 | * Webpack Plugins | 5 | * Webpack Plugins |
6 | */ | 6 | */ |
7 | 7 | ||
8 | var CopyWebpackPlugin = (CopyWebpackPlugin = require('copy-webpack-plugin'), CopyWebpackPlugin.default || CopyWebpackPlugin) | 8 | const CopyWebpackPlugin = require('copy-webpack-plugin') |
9 | const HtmlWebpackPlugin = require('html-webpack-plugin') | 9 | const HtmlWebpackPlugin = require('html-webpack-plugin') |
10 | const ForkCheckerPlugin = require('awesome-typescript-loader').ForkCheckerPlugin | 10 | const ForkCheckerPlugin = require('awesome-typescript-loader').ForkCheckerPlugin |
11 | const AssetsPlugin = require('assets-webpack-plugin') | ||
12 | const ContextReplacementPlugin = require('webpack/lib/ContextReplacementPlugin') | ||
11 | const WebpackNotifierPlugin = require('webpack-notifier') | 13 | const WebpackNotifierPlugin = require('webpack-notifier') |
12 | 14 | ||
13 | /* | 15 | /* |
@@ -15,7 +17,8 @@ const WebpackNotifierPlugin = require('webpack-notifier') | |||
15 | */ | 17 | */ |
16 | const METADATA = { | 18 | const METADATA = { |
17 | title: 'PeerTube', | 19 | title: 'PeerTube', |
18 | baseUrl: '/' | 20 | baseUrl: '/', |
21 | isDevServer: helpers.isWebpackDevServer() | ||
19 | } | 22 | } |
20 | 23 | ||
21 | /* | 24 | /* |
@@ -23,247 +26,241 @@ const METADATA = { | |||
23 | * | 26 | * |
24 | * See: http://webpack.github.io/docs/configuration.html#cli | 27 | * See: http://webpack.github.io/docs/configuration.html#cli |
25 | */ | 28 | */ |
26 | module.exports = { | 29 | module.exports = function (options) { |
27 | /* | 30 | var isProd = options.env === 'production' |
28 | * Static metadata for index.html | ||
29 | * | ||
30 | * See: (custom attribute) | ||
31 | */ | ||
32 | metadata: METADATA, | ||
33 | 31 | ||
34 | /* | 32 | return { |
35 | * Cache generated modules and chunks to improve performance for multiple incremental builds. | 33 | /* |
36 | * This is enabled by default in watch mode. | 34 | * Static metadata for index.html |
37 | * You can pass false to disable it. | 35 | * |
38 | * | 36 | * See: (custom attribute) |
39 | * See: http://webpack.github.io/docs/configuration.html#cache | 37 | */ |
40 | */ | 38 | metadata: METADATA, |
41 | // cache: false, | ||
42 | |||
43 | /* | ||
44 | * The entry point for the bundle | ||
45 | * Our Angular.js app | ||
46 | * | ||
47 | * See: http://webpack.github.io/docs/configuration.html#entry | ||
48 | */ | ||
49 | entry: { | ||
50 | 'polyfills': './src/polyfills.ts', | ||
51 | 'vendor': './src/vendor.ts', | ||
52 | 'main': './src/main.ts' | ||
53 | }, | ||
54 | 39 | ||
55 | /* | ||
56 | * Options affecting the resolving of modules. | ||
57 | * | ||
58 | * See: http://webpack.github.io/docs/configuration.html#resolve | ||
59 | */ | ||
60 | resolve: { | ||
61 | /* | 40 | /* |
62 | * An array of extensions that should be used to resolve modules. | 41 | * Cache generated modules and chunks to improve performance for multiple incremental builds. |
42 | * This is enabled by default in watch mode. | ||
43 | * You can pass false to disable it. | ||
63 | * | 44 | * |
64 | * See: http://webpack.github.io/docs/configuration.html#resolve-extensions | 45 | * See: http://webpack.github.io/docs/configuration.html#cache |
65 | */ | 46 | */ |
66 | extensions: [ '', '.ts', '.js', '.scss' ], | 47 | // cache: false, |
67 | 48 | ||
68 | // Make sure root is src | 49 | /* |
69 | root: helpers.root('src'), | 50 | * The entry point for the bundle |
51 | * Our Angular.js app | ||
52 | * | ||
53 | * See: http://webpack.github.io/docs/configuration.html#entry | ||
54 | */ | ||
55 | entry: { | ||
56 | 'polyfills': './src/polyfills.ts', | ||
57 | 'vendor': './src/vendor.ts', | ||
58 | 'main': './src/main.ts' | ||
59 | }, | ||
70 | 60 | ||
71 | // remove other default values | 61 | /* |
72 | modulesDirectories: [ 'node_modules' ], | 62 | * Options affecting the resolving of modules. |
63 | * | ||
64 | * See: http://webpack.github.io/docs/configuration.html#resolve | ||
65 | */ | ||
66 | resolve: { | ||
67 | /* | ||
68 | * An array of extensions that should be used to resolve modules. | ||
69 | * | ||
70 | * See: http://webpack.github.io/docs/configuration.html#resolve-extensions | ||
71 | */ | ||
72 | extensions: [ '', '.ts', '.js', '.scss' ], | ||
73 | 73 | ||
74 | packageAlias: 'browser' | 74 | // Make sure root is src |
75 | root: helpers.root('src'), | ||
75 | 76 | ||
76 | }, | 77 | // remove other default values |
78 | modulesDirectories: [ 'node_modules' ] | ||
79 | }, | ||
77 | 80 | ||
78 | output: { | 81 | output: { |
79 | publicPath: '/client/' | 82 | publicPath: '/client/' |
80 | }, | 83 | }, |
81 | 84 | ||
82 | /* | ||
83 | * Options affecting the normal modules. | ||
84 | * | ||
85 | * See: http://webpack.github.io/docs/configuration.html#module | ||
86 | */ | ||
87 | module: { | ||
88 | /* | 85 | /* |
89 | * An array of applied pre and post loaders. | 86 | * Options affecting the normal modules. |
90 | * | 87 | * |
91 | * See: http://webpack.github.io/docs/configuration.html#module-preloaders-module-postloaders | 88 | * See: http://webpack.github.io/docs/configuration.html#module |
92 | */ | 89 | */ |
93 | preLoaders: [ | 90 | module: { |
94 | |||
95 | /* | 91 | /* |
96 | * Tslint loader support for *.ts files | 92 | * An array of applied pre and post loaders. |
97 | * | 93 | * |
98 | * See: https://github.com/wbuchwalter/tslint-loader | 94 | * See: http://webpack.github.io/docs/configuration.html#module-preloaders-module-postloaders |
99 | */ | 95 | */ |
100 | // { test: /\.ts$/, loader: 'tslint-loader', exclude: [ helpers.root('node_modules') ] }, | 96 | preLoaders: [ |
97 | { | ||
98 | test: /\.ts$/, | ||
99 | loader: 'string-replace-loader', | ||
100 | query: { | ||
101 | search: '(System|SystemJS)(.*[\\n\\r]\\s*\\.|\\.)import\\((.+)\\)', | ||
102 | replace: '$1.import($3).then(mod => (mod.__esModule && mod.default) ? mod.default : mod)', | ||
103 | flags: 'g' | ||
104 | }, | ||
105 | include: [helpers.root('src')] | ||
106 | } | ||
107 | ], | ||
101 | 108 | ||
102 | /* | 109 | /* |
103 | * Source map loader support for *.js files | 110 | * An array of automatically applied loaders. |
104 | * Extracts SourceMaps for source files that as added as sourceMappingURL comment. | 111 | * |
112 | * IMPORTANT: The loaders here are resolved relative to the resource which they are applied to. | ||
113 | * This means they are not resolved relative to the configuration file. | ||
105 | * | 114 | * |
106 | * See: https://github.com/webpack/source-map-loader | 115 | * See: http://webpack.github.io/docs/configuration.html#module-loaders |
107 | */ | 116 | */ |
108 | { | 117 | loaders: [ |
109 | test: /\.js$/, | 118 | |
110 | loader: 'source-map-loader', | 119 | /* |
111 | exclude: [ | 120 | * Typescript loader support for .ts and Angular 2 async routes via .async.ts |
112 | // these packages have problems with their sourcemaps | 121 | * |
113 | helpers.root('node_modules/rxjs'), | 122 | * See: https://github.com/s-panferov/awesome-typescript-loader |
114 | helpers.root('node_modules/@angular') | 123 | */ |
115 | ] | 124 | { |
116 | } | 125 | test: /\.ts$/, |
117 | 126 | loaders: [ | |
118 | ], | 127 | '@angularclass/hmr-loader?pretty=' + !isProd + '&prod=' + isProd, |
128 | 'awesome-typescript-loader', | ||
129 | 'angular2-template-loader' | ||
130 | ], | ||
131 | exclude: [/\.(spec|e2e)\.ts$/] | ||
132 | }, | ||
133 | |||
134 | /* | ||
135 | * Json loader support for *.json files. | ||
136 | * | ||
137 | * See: https://github.com/webpack/json-loader | ||
138 | */ | ||
139 | { | ||
140 | test: /\.json$/, | ||
141 | loader: 'json-loader' | ||
142 | }, | ||
143 | |||
144 | { | ||
145 | test: /\.(sass|scss)$/, | ||
146 | loaders: ['css-to-string-loader', 'css-loader?sourceMap', 'resolve-url', 'sass-loader?sourceMap'] | ||
147 | }, | ||
148 | { test: /\.woff(2)?(\?v=[0-9]\.[0-9]\.[0-9])?$/, loader: 'url?limit=10000&minetype=application/font-woff' }, | ||
149 | { test: /\.(ttf|eot|svg)(\?v=[0-9]\.[0-9]\.[0-9])?$/, loader: 'file' }, | ||
150 | |||
151 | /* Raw loader support for *.html | ||
152 | * Returns file content as string | ||
153 | * | ||
154 | * See: https://github.com/webpack/raw-loader | ||
155 | */ | ||
156 | { | ||
157 | test: /\.html$/, | ||
158 | loader: 'raw-loader', | ||
159 | exclude: [ helpers.root('src/index.html') ] | ||
160 | } | ||
161 | |||
162 | ] | ||
163 | |||
164 | }, | ||
165 | |||
166 | sassLoader: { | ||
167 | precision: 10 | ||
168 | }, | ||
119 | 169 | ||
120 | /* | 170 | /* |
121 | * An array of automatically applied loaders. | 171 | * Add additional plugins to the compiler. |
122 | * | ||
123 | * IMPORTANT: The loaders here are resolved relative to the resource which they are applied to. | ||
124 | * This means they are not resolved relative to the configuration file. | ||
125 | * | 172 | * |
126 | * See: http://webpack.github.io/docs/configuration.html#module-loaders | 173 | * See: http://webpack.github.io/docs/configuration.html#plugins |
127 | */ | 174 | */ |
128 | loaders: [ | 175 | plugins: [ |
176 | new AssetsPlugin({ | ||
177 | path: helpers.root('dist'), | ||
178 | filename: 'webpack-assets.json', | ||
179 | prettyPrint: true | ||
180 | }), | ||
129 | 181 | ||
130 | /* | 182 | /* |
131 | * Typescript loader support for .ts and Angular 2 async routes via .async.ts | 183 | * Plugin: ForkCheckerPlugin |
184 | * Description: Do type checking in a separate process, so webpack don't need to wait. | ||
132 | * | 185 | * |
133 | * See: https://github.com/s-panferov/awesome-typescript-loader | 186 | * See: https://github.com/s-panferov/awesome-typescript-loader#forkchecker-boolean-defaultfalse |
134 | */ | 187 | */ |
135 | { | 188 | new ForkCheckerPlugin(), |
136 | test: /\.ts$/, | ||
137 | loader: 'awesome-typescript-loader', | ||
138 | exclude: [/\.(spec|e2e)\.ts$/] | ||
139 | }, | ||
140 | 189 | ||
141 | /* | 190 | /* |
142 | * Json loader support for *.json files. | 191 | * Plugin: CommonsChunkPlugin |
192 | * Description: Shares common code between the pages. | ||
193 | * It identifies common modules and put them into a commons chunk. | ||
143 | * | 194 | * |
144 | * See: https://github.com/webpack/json-loader | 195 | * See: https://webpack.github.io/docs/list-of-plugins.html#commonschunkplugin |
196 | * See: https://github.com/webpack/docs/wiki/optimization#multi-page-app | ||
145 | */ | 197 | */ |
146 | { | 198 | new webpack.optimize.CommonsChunkPlugin({ |
147 | test: /\.json$/, | 199 | name: [ 'polyfills', 'vendor' ].reverse() |
148 | loader: 'json-loader' | 200 | }), |
149 | }, | ||
150 | 201 | ||
151 | { | 202 | /** |
152 | test: /\.scss$/, | 203 | * Plugin: ContextReplacementPlugin |
153 | exclude: /node_modules/, | 204 | * Description: Provides context to Angular's use of System.import |
154 | loaders: [ 'raw-loader', 'sass-loader' ] | 205 | * |
155 | }, | 206 | * See: https://webpack.github.io/docs/list-of-plugins.html#contextreplacementplugin |
156 | 207 | * See: https://github.com/angular/angular/issues/11580 | |
157 | { | 208 | */ |
158 | test: /\.(woff2?|ttf|eot|svg)$/, | 209 | new ContextReplacementPlugin( |
159 | loader: 'url?limit=10000&name=assets/fonts/[hash].[ext]' | 210 | // The (\\|\/) piece accounts for path separators in *nix and Windows |
160 | }, | 211 | /angular(\\|\/)core(\\|\/)(esm(\\|\/)src|src)(\\|\/)linker/, |
212 | helpers.root('src') // location of your src | ||
213 | ), | ||
161 | 214 | ||
162 | /* Raw loader support for *.html | 215 | /* |
163 | * Returns file content as string | 216 | * Plugin: CopyWebpackPlugin |
217 | * Description: Copy files and directories in webpack. | ||
164 | * | 218 | * |
165 | * See: https://github.com/webpack/raw-loader | 219 | * Copies project static assets. |
220 | * | ||
221 | * See: https://www.npmjs.com/package/copy-webpack-plugin | ||
166 | */ | 222 | */ |
167 | { | 223 | new CopyWebpackPlugin([ |
168 | test: /\.html$/, | 224 | { |
169 | loader: 'raw-loader', | 225 | from: 'src/assets', |
170 | exclude: [ helpers.root('src/index.html') ] | 226 | to: 'assets' |
171 | } | 227 | }, |
172 | 228 | { | |
173 | ] | 229 | from: 'node_modules/webtorrent/webtorrent.min.js', |
174 | 230 | to: 'assets/webtorrent' | |
175 | }, | 231 | } |
232 | ]), | ||
176 | 233 | ||
177 | sassLoader: { | 234 | /* |
178 | precision: 10 | 235 | * Plugin: HtmlWebpackPlugin |
179 | }, | 236 | * Description: Simplifies creation of HTML files to serve your webpack bundles. |
180 | 237 | * This is especially useful for webpack bundles that include a hash in the filename | |
181 | /* | 238 | * which changes every compilation. |
182 | * Add additional plugins to the compiler. | 239 | * |
183 | * | 240 | * See: https://github.com/ampedandwired/html-webpack-plugin |
184 | * See: http://webpack.github.io/docs/configuration.html#plugins | 241 | */ |
185 | */ | 242 | new HtmlWebpackPlugin({ |
186 | plugins: [ | 243 | template: 'src/index.html', |
187 | 244 | chunksSortMode: 'dependency' | |
188 | /* | 245 | }), |
189 | * Plugin: ForkCheckerPlugin | ||
190 | * Description: Do type checking in a separate process, so webpack don't need to wait. | ||
191 | * | ||
192 | * See: https://github.com/s-panferov/awesome-typescript-loader#forkchecker-boolean-defaultfalse | ||
193 | */ | ||
194 | new ForkCheckerPlugin(), | ||
195 | |||
196 | /* | ||
197 | * Plugin: OccurenceOrderPlugin | ||
198 | * Description: Varies the distribution of the ids to get the smallest id length | ||
199 | * for often used ids. | ||
200 | * | ||
201 | * See: https://webpack.github.io/docs/list-of-plugins.html#occurrenceorderplugin | ||
202 | * See: https://github.com/webpack/docs/wiki/optimization#minimize | ||
203 | */ | ||
204 | new webpack.optimize.OccurenceOrderPlugin(true), | ||
205 | |||
206 | /* | ||
207 | * Plugin: CommonsChunkPlugin | ||
208 | * Description: Shares common code between the pages. | ||
209 | * It identifies common modules and put them into a commons chunk. | ||
210 | * | ||
211 | * See: https://webpack.github.io/docs/list-of-plugins.html#commonschunkplugin | ||
212 | * See: https://github.com/webpack/docs/wiki/optimization#multi-page-app | ||
213 | */ | ||
214 | new webpack.optimize.CommonsChunkPlugin({ | ||
215 | name: [ 'polyfills', 'vendor' ].reverse() | ||
216 | }), | ||
217 | 246 | ||
218 | /* | 247 | new WebpackNotifierPlugin({ alwaysNotify: true }) |
219 | * Plugin: CopyWebpackPlugin | 248 | ], |
220 | * Description: Copy files and directories in webpack. | ||
221 | * | ||
222 | * Copies project static assets. | ||
223 | * | ||
224 | * See: https://www.npmjs.com/package/copy-webpack-plugin | ||
225 | */ | ||
226 | new CopyWebpackPlugin([ | ||
227 | { | ||
228 | from: 'src/assets', | ||
229 | to: 'assets' | ||
230 | }, | ||
231 | { | ||
232 | from: 'node_modules/webtorrent/webtorrent.min.js', | ||
233 | to: 'assets/webtorrent' | ||
234 | } | ||
235 | ]), | ||
236 | 249 | ||
237 | /* | 250 | /* |
238 | * Plugin: HtmlWebpackPlugin | 251 | * Include polyfills or mocks for various node stuff |
239 | * Description: Simplifies creation of HTML files to serve your webpack bundles. | 252 | * Description: Node configuration |
240 | * This is especially useful for webpack bundles that include a hash in the filename | ||
241 | * which changes every compilation. | ||
242 | * | 253 | * |
243 | * See: https://github.com/ampedandwired/html-webpack-plugin | 254 | * See: https://webpack.github.io/docs/configuration.html#node |
244 | */ | 255 | */ |
245 | new HtmlWebpackPlugin({ | 256 | node: { |
246 | template: 'src/index.html', | 257 | global: 'window', |
247 | chunksSortMode: 'dependency' | 258 | crypto: 'empty', |
248 | }), | 259 | fs: 'empty', |
249 | 260 | events: true, | |
250 | new WebpackNotifierPlugin({ alwaysNotify: true }) | 261 | module: false, |
251 | ], | 262 | clearImmediate: false, |
252 | 263 | setImmediate: false | |
253 | /* | 264 | } |
254 | * Include polyfills or mocks for various node stuff | ||
255 | * Description: Node configuration | ||
256 | * | ||
257 | * See: https://webpack.github.io/docs/configuration.html#node | ||
258 | */ | ||
259 | node: { | ||
260 | global: 'window', | ||
261 | crypto: 'empty', | ||
262 | fs: 'empty', | ||
263 | events: true, | ||
264 | module: false, | ||
265 | clearImmediate: false, | ||
266 | setImmediate: false | ||
267 | } | 265 | } |
268 | |||
269 | } | 266 | } |
diff --git a/client/config/webpack.dev.js b/client/config/webpack.dev.js index 50193bf58..0b6c00cbd 100644 --- a/client/config/webpack.dev.js +++ b/client/config/webpack.dev.js | |||
@@ -6,15 +6,18 @@ const commonConfig = require('./webpack.common.js') // the settings that are com | |||
6 | * Webpack Plugins | 6 | * Webpack Plugins |
7 | */ | 7 | */ |
8 | const DefinePlugin = require('webpack/lib/DefinePlugin') | 8 | const DefinePlugin = require('webpack/lib/DefinePlugin') |
9 | const NamedModulesPlugin = require('webpack/lib/NamedModulesPlugin') | ||
9 | 10 | ||
10 | /** | 11 | /** |
11 | * Webpack Constants | 12 | * Webpack Constants |
12 | */ | 13 | */ |
13 | const ENV = process.env.ENV = process.env.NODE_ENV = 'development' | 14 | const ENV = process.env.ENV = process.env.NODE_ENV = 'development' |
15 | const HOST = process.env.HOST || 'localhost' | ||
16 | const PORT = process.env.PORT || 3000 | ||
14 | const HMR = helpers.hasProcessFlag('hot') | 17 | const HMR = helpers.hasProcessFlag('hot') |
15 | const METADATA = webpackMerge(commonConfig.metadata, { | 18 | const METADATA = webpackMerge(commonConfig({env: ENV}).metadata, { |
16 | host: 'localhost', | 19 | host: HOST, |
17 | port: 3000, | 20 | port: PORT, |
18 | ENV: ENV, | 21 | ENV: ENV, |
19 | HMR: HMR | 22 | HMR: HMR |
20 | }) | 23 | }) |
@@ -24,119 +27,136 @@ const METADATA = webpackMerge(commonConfig.metadata, { | |||
24 | * | 27 | * |
25 | * See: http://webpack.github.io/docs/configuration.html#cli | 28 | * See: http://webpack.github.io/docs/configuration.html#cli |
26 | */ | 29 | */ |
27 | module.exports = webpackMerge(commonConfig, { | 30 | module.exports = function (env) { |
28 | /** | 31 | return webpackMerge(commonConfig({env: ENV}), { |
29 | * Merged metadata from webpack.common.js for index.html | ||
30 | * | ||
31 | * See: (custom attribute) | ||
32 | */ | ||
33 | metadata: METADATA, | ||
34 | |||
35 | /** | ||
36 | * Switch loaders to debug mode. | ||
37 | * | ||
38 | * See: http://webpack.github.io/docs/configuration.html#debug | ||
39 | */ | ||
40 | debug: true, | ||
41 | |||
42 | /** | ||
43 | * Developer tool to enhance debugging | ||
44 | * | ||
45 | * See: http://webpack.github.io/docs/configuration.html#devtool | ||
46 | * See: https://github.com/webpack/docs/wiki/build-performance#sourcemaps | ||
47 | */ | ||
48 | devtool: 'cheap-module-source-map', | ||
49 | |||
50 | /** | ||
51 | * Options affecting the output of the compilation. | ||
52 | * | ||
53 | * See: http://webpack.github.io/docs/configuration.html#output | ||
54 | */ | ||
55 | output: { | ||
56 | /** | 32 | /** |
57 | * The output directory as absolute path (required). | 33 | * Merged metadata from webpack.common.js for index.html |
58 | * | 34 | * |
59 | * See: http://webpack.github.io/docs/configuration.html#output-path | 35 | * See: (custom attribute) |
60 | */ | 36 | */ |
61 | path: helpers.root('dist'), | 37 | metadata: METADATA, |
62 | 38 | ||
63 | /** | 39 | /** |
64 | * Specifies the name of each output file on disk. | 40 | * Switch loaders to debug mode. |
65 | * IMPORTANT: You must not specify an absolute path here! | ||
66 | * | 41 | * |
67 | * See: http://webpack.github.io/docs/configuration.html#output-filename | 42 | * See: http://webpack.github.io/docs/configuration.html#debug |
68 | */ | 43 | */ |
69 | filename: '[name].bundle.js', | 44 | debug: true, |
70 | 45 | ||
71 | /** | 46 | /** |
72 | * The filename of the SourceMaps for the JavaScript files. | 47 | * Developer tool to enhance debugging |
73 | * They are inside the output.path directory. | ||
74 | * | 48 | * |
75 | * See: http://webpack.github.io/docs/configuration.html#output-sourcemapfilename | 49 | * See: http://webpack.github.io/docs/configuration.html#devtool |
50 | * See: https://github.com/webpack/docs/wiki/build-performance#sourcemaps | ||
76 | */ | 51 | */ |
77 | sourceMapFilename: '[name].map', | 52 | devtool: 'cheap-module-source-map', |
78 | 53 | ||
79 | /** The filename of non-entry chunks as relative path | 54 | /** |
80 | * inside the output.path directory. | 55 | * Options affecting the output of the compilation. |
81 | * | 56 | * |
82 | * See: http://webpack.github.io/docs/configuration.html#output-chunkfilename | 57 | * See: http://webpack.github.io/docs/configuration.html#output |
83 | */ | 58 | */ |
84 | chunkFilename: '[id].chunk.js' | 59 | output: { |
85 | 60 | /** | |
86 | }, | 61 | * The output directory as absolute path (required). |
87 | 62 | * | |
88 | externals: { | 63 | * See: http://webpack.github.io/docs/configuration.html#output-path |
89 | webtorrent: 'WebTorrent' | 64 | */ |
90 | }, | 65 | path: helpers.root('dist'), |
66 | |||
67 | /** | ||
68 | * Specifies the name of each output file on disk. | ||
69 | * IMPORTANT: You must not specify an absolute path here! | ||
70 | * | ||
71 | * See: http://webpack.github.io/docs/configuration.html#output-filename | ||
72 | */ | ||
73 | filename: '[name].bundle.js', | ||
74 | |||
75 | /** | ||
76 | * The filename of the SourceMaps for the JavaScript files. | ||
77 | * They are inside the output.path directory. | ||
78 | * | ||
79 | * See: http://webpack.github.io/docs/configuration.html#output-sourcemapfilename | ||
80 | */ | ||
81 | sourceMapFilename: '[name].map', | ||
82 | |||
83 | /** The filename of non-entry chunks as relative path | ||
84 | * inside the output.path directory. | ||
85 | * | ||
86 | * See: http://webpack.github.io/docs/configuration.html#output-chunkfilename | ||
87 | */ | ||
88 | chunkFilename: '[id].chunk.js', | ||
89 | |||
90 | library: 'ac_[name]', | ||
91 | libraryTarget: 'var' | ||
92 | |||
93 | }, | ||
94 | |||
95 | externals: { | ||
96 | webtorrent: 'WebTorrent' | ||
97 | }, | ||
98 | |||
99 | plugins: [ | ||
100 | |||
101 | /** | ||
102 | * Plugin: DefinePlugin | ||
103 | * Description: Define free variables. | ||
104 | * Useful for having development builds with debug logging or adding global constants. | ||
105 | * | ||
106 | * Environment helpers | ||
107 | * | ||
108 | * See: https://webpack.github.io/docs/list-of-plugins.html#defineplugin | ||
109 | */ | ||
110 | // NOTE: when adding more properties, make sure you include them in custom-typings.d.ts | ||
111 | new DefinePlugin({ | ||
112 | 'ENV': JSON.stringify(METADATA.ENV), | ||
113 | 'HMR': METADATA.HMR, | ||
114 | 'process.env': { | ||
115 | 'ENV': JSON.stringify(METADATA.ENV), | ||
116 | 'NODE_ENV': JSON.stringify(METADATA.ENV), | ||
117 | 'HMR': METADATA.HMR | ||
118 | } | ||
119 | }), | ||
91 | 120 | ||
92 | plugins: [ | 121 | new NamedModulesPlugin() |
122 | ], | ||
93 | 123 | ||
94 | /** | 124 | /** |
95 | * Plugin: DefinePlugin | 125 | * Static analysis linter for TypeScript advanced options configuration |
96 | * Description: Define free variables. | 126 | * Description: An extensible linter for the TypeScript language. |
97 | * Useful for having development builds with debug logging or adding global constants. | ||
98 | * | 127 | * |
99 | * Environment helpers | 128 | * See: https://github.com/wbuchwalter/tslint-loader |
129 | */ | ||
130 | tslint: { | ||
131 | emitErrors: false, | ||
132 | failOnHint: false, | ||
133 | resourcePath: 'src' | ||
134 | }, | ||
135 | |||
136 | devServer: { | ||
137 | port: METADATA.port, | ||
138 | host: METADATA.host, | ||
139 | historyApiFallback: true, | ||
140 | watchOptions: { | ||
141 | aggregateTimeout: 300, | ||
142 | poll: 1000 | ||
143 | }, | ||
144 | outputPath: helpers.root('dist') | ||
145 | }, | ||
146 | |||
147 | /* | ||
148 | * Include polyfills or mocks for various node stuff | ||
149 | * Description: Node configuration | ||
100 | * | 150 | * |
101 | * See: https://webpack.github.io/docs/list-of-plugins.html#defineplugin | 151 | * See: https://webpack.github.io/docs/configuration.html#node |
102 | */ | 152 | */ |
103 | // NOTE: when adding more properties, make sure you include them in custom-typings.d.ts | 153 | node: { |
104 | new DefinePlugin({ | 154 | global: 'window', |
105 | 'ENV': JSON.stringify(METADATA.ENV), | 155 | crypto: 'empty', |
106 | 'HMR': METADATA.HMR, | 156 | process: true, |
107 | 'process.env': { | 157 | module: false, |
108 | 'ENV': JSON.stringify(METADATA.ENV), | 158 | clearImmediate: false, |
109 | 'NODE_ENV': JSON.stringify(METADATA.ENV), | 159 | setImmediate: false |
110 | 'HMR': METADATA.HMR | 160 | } |
111 | } | 161 | }) |
112 | }) | 162 | } |
113 | ], | ||
114 | |||
115 | /** | ||
116 | * Static analysis linter for TypeScript advanced options configuration | ||
117 | * Description: An extensible linter for the TypeScript language. | ||
118 | * | ||
119 | * See: https://github.com/wbuchwalter/tslint-loader | ||
120 | */ | ||
121 | tslint: { | ||
122 | emitErrors: false, | ||
123 | failOnHint: false, | ||
124 | resourcePath: 'src' | ||
125 | }, | ||
126 | |||
127 | /* | ||
128 | * Include polyfills or mocks for various node stuff | ||
129 | * Description: Node configuration | ||
130 | * | ||
131 | * See: https://webpack.github.io/docs/configuration.html#node | ||
132 | */ | ||
133 | node: { | ||
134 | global: 'window', | ||
135 | crypto: 'empty', | ||
136 | process: true, | ||
137 | module: false, | ||
138 | clearImmediate: false, | ||
139 | setImmediate: false | ||
140 | } | ||
141 | |||
142 | }) | ||
diff --git a/client/config/webpack.prod.js b/client/config/webpack.prod.js index 7ce5727d3..46db54482 100644 --- a/client/config/webpack.prod.js +++ b/client/config/webpack.prod.js | |||
@@ -9,10 +9,12 @@ const commonConfig = require('./webpack.common.js') // the settings that are com | |||
9 | /** | 9 | /** |
10 | * Webpack Plugins | 10 | * Webpack Plugins |
11 | */ | 11 | */ |
12 | // const ProvidePlugin = require('webpack/lib/ProvidePlugin') | ||
12 | const DefinePlugin = require('webpack/lib/DefinePlugin') | 13 | const DefinePlugin = require('webpack/lib/DefinePlugin') |
13 | const DedupePlugin = require('webpack/lib/optimize/DedupePlugin') | 14 | const NormalModuleReplacementPlugin = require('webpack/lib/NormalModuleReplacementPlugin') |
15 | // const IgnorePlugin = require('webpack/lib/IgnorePlugin') | ||
16 | // const DedupePlugin = require('webpack/lib/optimize/DedupePlugin') | ||
14 | const UglifyJsPlugin = require('webpack/lib/optimize/UglifyJsPlugin') | 17 | const UglifyJsPlugin = require('webpack/lib/optimize/UglifyJsPlugin') |
15 | const CompressionPlugin = require('compression-webpack-plugin') | ||
16 | const WebpackMd5Hash = require('webpack-md5-hash') | 18 | const WebpackMd5Hash = require('webpack-md5-hash') |
17 | 19 | ||
18 | /** | 20 | /** |
@@ -21,211 +23,210 @@ const WebpackMd5Hash = require('webpack-md5-hash') | |||
21 | const ENV = process.env.NODE_ENV = process.env.ENV = 'production' | 23 | const ENV = process.env.NODE_ENV = process.env.ENV = 'production' |
22 | const HOST = process.env.HOST || 'localhost' | 24 | const HOST = process.env.HOST || 'localhost' |
23 | const PORT = process.env.PORT || 8080 | 25 | const PORT = process.env.PORT || 8080 |
24 | const METADATA = webpackMerge(commonConfig.metadata, { | 26 | const METADATA = webpackMerge(commonConfig({env: ENV}).metadata, { |
25 | host: HOST, | 27 | host: HOST, |
26 | port: PORT, | 28 | port: PORT, |
27 | ENV: ENV, | 29 | ENV: ENV, |
28 | HMR: false | 30 | HMR: false |
29 | }) | 31 | }) |
30 | 32 | ||
31 | module.exports = webpackMerge(commonConfig, { | 33 | module.exports = function (env) { |
32 | /** | 34 | return webpackMerge(commonConfig({env: ENV}), { |
33 | * Switch loaders to debug mode. | ||
34 | * | ||
35 | * See: http://webpack.github.io/docs/configuration.html#debug | ||
36 | */ | ||
37 | debug: false, | ||
38 | |||
39 | /** | ||
40 | * Developer tool to enhance debugging | ||
41 | * | ||
42 | * See: http://webpack.github.io/docs/configuration.html#devtool | ||
43 | * See: https://github.com/webpack/docs/wiki/build-performance#sourcemaps | ||
44 | */ | ||
45 | devtool: 'source-map', | ||
46 | |||
47 | /** | ||
48 | * Options affecting the output of the compilation. | ||
49 | * | ||
50 | * See: http://webpack.github.io/docs/configuration.html#output | ||
51 | */ | ||
52 | output: { | ||
53 | /** | 35 | /** |
54 | * The output directory as absolute path (required). | 36 | * Switch loaders to debug mode. |
55 | * | 37 | * |
56 | * See: http://webpack.github.io/docs/configuration.html#output-path | 38 | * See: http://webpack.github.io/docs/configuration.html#debug |
57 | */ | 39 | */ |
58 | path: helpers.root('dist'), | 40 | debug: false, |
59 | 41 | ||
60 | /** | 42 | /** |
61 | * Specifies the name of each output file on disk. | 43 | * Developer tool to enhance debugging |
62 | * IMPORTANT: You must not specify an absolute path here! | ||
63 | * | 44 | * |
64 | * See: http://webpack.github.io/docs/configuration.html#output-filename | 45 | * See: http://webpack.github.io/docs/configuration.html#devtool |
46 | * See: https://github.com/webpack/docs/wiki/build-performance#sourcemaps | ||
65 | */ | 47 | */ |
66 | filename: '[name].[chunkhash].bundle.js', | 48 | devtool: 'source-map', |
67 | 49 | ||
68 | /** | 50 | /** |
69 | * The filename of the SourceMaps for the JavaScript files. | 51 | * Options affecting the output of the compilation. |
70 | * They are inside the output.path directory. | ||
71 | * | 52 | * |
72 | * See: http://webpack.github.io/docs/configuration.html#output-sourcemapfilename | 53 | * See: http://webpack.github.io/docs/configuration.html#output |
73 | */ | 54 | */ |
74 | sourceMapFilename: '[name].[chunkhash].bundle.map', | 55 | output: { |
56 | /** | ||
57 | * The output directory as absolute path (required). | ||
58 | * | ||
59 | * See: http://webpack.github.io/docs/configuration.html#output-path | ||
60 | */ | ||
61 | path: helpers.root('dist'), | ||
62 | |||
63 | /** | ||
64 | * Specifies the name of each output file on disk. | ||
65 | * IMPORTANT: You must not specify an absolute path here! | ||
66 | * | ||
67 | * See: http://webpack.github.io/docs/configuration.html#output-filename | ||
68 | */ | ||
69 | filename: '[name].[chunkhash].bundle.js', | ||
70 | |||
71 | /** | ||
72 | * The filename of the SourceMaps for the JavaScript files. | ||
73 | * They are inside the output.path directory. | ||
74 | * | ||
75 | * See: http://webpack.github.io/docs/configuration.html#output-sourcemapfilename | ||
76 | */ | ||
77 | sourceMapFilename: '[name].[chunkhash].bundle.map', | ||
78 | |||
79 | /** | ||
80 | * The filename of non-entry chunks as relative path | ||
81 | * inside the output.path directory. | ||
82 | * | ||
83 | * See: http://webpack.github.io/docs/configuration.html#output-chunkfilename | ||
84 | */ | ||
85 | chunkFilename: '[id].[chunkhash].chunk.js' | ||
86 | |||
87 | }, | ||
88 | |||
89 | externals: { | ||
90 | webtorrent: 'WebTorrent' | ||
91 | }, | ||
75 | 92 | ||
76 | /** | 93 | /** |
77 | * The filename of non-entry chunks as relative path | 94 | * Add additional plugins to the compiler. |
78 | * inside the output.path directory. | ||
79 | * | 95 | * |
80 | * See: http://webpack.github.io/docs/configuration.html#output-chunkfilename | 96 | * See: http://webpack.github.io/docs/configuration.html#plugins |
81 | */ | 97 | */ |
82 | chunkFilename: '[id].[chunkhash].chunk.js' | 98 | plugins: [ |
83 | 99 | ||
84 | }, | 100 | /** |
85 | 101 | * Plugin: WebpackMd5Hash | |
86 | externals: { | 102 | * Description: Plugin to replace a standard webpack chunkhash with md5. |
87 | webtorrent: 'WebTorrent' | 103 | * |
88 | }, | 104 | * See: https://www.npmjs.com/package/webpack-md5-hash |
89 | 105 | */ | |
90 | /** | 106 | new WebpackMd5Hash(), |
91 | * Add additional plugins to the compiler. | 107 | |
92 | * | 108 | /** |
93 | * See: http://webpack.github.io/docs/configuration.html#plugins | 109 | * Plugin: DedupePlugin |
94 | */ | 110 | * Description: Prevents the inclusion of duplicate code into your bundle |
95 | plugins: [ | 111 | * and instead applies a copy of the function at runtime. |
96 | 112 | * | |
97 | /** | 113 | * See: https://webpack.github.io/docs/list-of-plugins.html#defineplugin |
98 | * Plugin: WebpackMd5Hash | 114 | * See: https://github.com/webpack/docs/wiki/optimization#deduplication |
99 | * Description: Plugin to replace a standard webpack chunkhash with md5. | 115 | */ |
100 | * | 116 | // new DedupePlugin(), |
101 | * See: https://www.npmjs.com/package/webpack-md5-hash | 117 | |
102 | */ | 118 | /** |
103 | new WebpackMd5Hash(), | 119 | * Plugin: DefinePlugin |
120 | * Description: Define free variables. | ||
121 | * Useful for having development builds with debug logging or adding global constants. | ||
122 | * | ||
123 | * Environment helpers | ||
124 | * | ||
125 | * See: https://webpack.github.io/docs/list-of-plugins.html#defineplugin | ||
126 | */ | ||
127 | // NOTE: when adding more properties make sure you include them in custom-typings.d.ts | ||
128 | new DefinePlugin({ | ||
129 | 'ENV': JSON.stringify(METADATA.ENV), | ||
130 | 'HMR': METADATA.HMR, | ||
131 | 'process.env': { | ||
132 | 'ENV': JSON.stringify(METADATA.ENV), | ||
133 | 'NODE_ENV': JSON.stringify(METADATA.ENV), | ||
134 | 'HMR': METADATA.HMR | ||
135 | } | ||
136 | }), | ||
137 | |||
138 | /** | ||
139 | * Plugin: UglifyJsPlugin | ||
140 | * Description: Minimize all JavaScript output of chunks. | ||
141 | * Loaders are switched into minimizing mode. | ||
142 | * | ||
143 | * See: https://webpack.github.io/docs/list-of-plugins.html#uglifyjsplugin | ||
144 | */ | ||
145 | // NOTE: To debug prod builds uncomment //debug lines and comment //prod lines | ||
146 | new UglifyJsPlugin({ | ||
147 | // beautify: true, //debug | ||
148 | // mangle: false, //debug | ||
149 | // dead_code: false, //debug | ||
150 | // unused: false, //debug | ||
151 | // deadCode: false, //debug | ||
152 | // compress: { | ||
153 | // screw_ie8: true, | ||
154 | // keep_fnames: true, | ||
155 | // drop_debugger: false, | ||
156 | // dead_code: false, | ||
157 | // unused: false | ||
158 | // }, // debug | ||
159 | // comments: true, //debug | ||
160 | |||
161 | beautify: false, // prod | ||
162 | mangle: { screw_ie8: true, keep_fnames: true }, // prod | ||
163 | compress: { screw_ie8: true }, // prod | ||
164 | comments: false // prod | ||
165 | }), | ||
166 | |||
167 | new NormalModuleReplacementPlugin( | ||
168 | /angular2-hmr/, | ||
169 | helpers.root('config/modules/angular2-hmr-prod.js') | ||
170 | ) | ||
171 | |||
172 | /** | ||
173 | * Plugin: CompressionPlugin | ||
174 | * Description: Prepares compressed versions of assets to serve | ||
175 | * them with Content-Encoding | ||
176 | * | ||
177 | * See: https://github.com/webpack/compression-webpack-plugin | ||
178 | */ | ||
179 | // new CompressionPlugin({ | ||
180 | // regExp: /\.css$|\.html$|\.js$|\.map$/, | ||
181 | // threshold: 2 * 1024 | ||
182 | // }) | ||
104 | 183 | ||
105 | /** | 184 | ], |
106 | * Plugin: DedupePlugin | ||
107 | * Description: Prevents the inclusion of duplicate code into your bundle | ||
108 | * and instead applies a copy of the function at runtime. | ||
109 | * | ||
110 | * See: https://webpack.github.io/docs/list-of-plugins.html#defineplugin | ||
111 | * See: https://github.com/webpack/docs/wiki/optimization#deduplication | ||
112 | */ | ||
113 | new DedupePlugin(), | ||
114 | 185 | ||
115 | /** | 186 | /** |
116 | * Plugin: DefinePlugin | 187 | * Static analysis linter for TypeScript advanced options configuration |
117 | * Description: Define free variables. | 188 | * Description: An extensible linter for the TypeScript language. |
118 | * Useful for having development builds with debug logging or adding global constants. | ||
119 | * | ||
120 | * Environment helpers | ||
121 | * | 189 | * |
122 | * See: https://webpack.github.io/docs/list-of-plugins.html#defineplugin | 190 | * See: https://github.com/wbuchwalter/tslint-loader |
123 | */ | 191 | */ |
124 | // NOTE: when adding more properties make sure you include them in custom-typings.d.ts | 192 | tslint: { |
125 | new DefinePlugin({ | 193 | emitErrors: true, |
126 | 'ENV': JSON.stringify(METADATA.ENV), | 194 | failOnHint: true, |
127 | 'HMR': METADATA.HMR, | 195 | resourcePath: 'src' |
128 | 'process.env': { | 196 | }, |
129 | 'ENV': JSON.stringify(METADATA.ENV), | ||
130 | 'NODE_ENV': JSON.stringify(METADATA.ENV), | ||
131 | 'HMR': METADATA.HMR | ||
132 | } | ||
133 | }), | ||
134 | 197 | ||
135 | /** | 198 | /** |
136 | * Plugin: UglifyJsPlugin | 199 | * Html loader advanced options |
137 | * Description: Minimize all JavaScript output of chunks. | ||
138 | * Loaders are switched into minimizing mode. | ||
139 | * | 200 | * |
140 | * See: https://webpack.github.io/docs/list-of-plugins.html#uglifyjsplugin | 201 | * See: https://github.com/webpack/html-loader#advanced-options |
141 | */ | 202 | */ |
142 | // NOTE: To debug prod builds uncomment //debug lines and comment //prod lines | 203 | // TODO: Need to workaround Angular 2's html syntax => #id [bind] (event) *ngFor |
143 | new UglifyJsPlugin({ | 204 | htmlLoader: { |
144 | // beautify: true, //debug | 205 | minimize: true, |
145 | // mangle: false, //debug | 206 | removeAttributeQuotes: false, |
146 | // dead_code: false, //debug | 207 | caseSensitive: true, |
147 | // unused: false, //debug | 208 | customAttrSurround: [ |
148 | // deadCode: false, //debug | 209 | [/#/, /(?:)/], |
149 | // compress: { | 210 | [/\*/, /(?:)/], |
150 | // screw_ie8: true, | 211 | [/\[?\(?/, /(?:)/] |
151 | // keep_fnames: true, | 212 | ], |
152 | // drop_debugger: false, | 213 | customAttrAssign: [/\)?\]?=/] |
153 | // dead_code: false, | 214 | }, |
154 | // unused: false | 215 | |
155 | // }, // debug | 216 | /* |
156 | // comments: true, //debug | 217 | * Include polyfills or mocks for various node stuff |
157 | 218 | * Description: Node configuration | |
158 | beautify: false, // prod | ||
159 | |||
160 | mangle: { | ||
161 | screw_ie8: true, | ||
162 | keep_fnames: true | ||
163 | }, // prod | ||
164 | |||
165 | compress: { | ||
166 | screw_ie8: true | ||
167 | }, // prod | ||
168 | |||
169 | comments: false // prod | ||
170 | }), | ||
171 | |||
172 | /** | ||
173 | * Plugin: CompressionPlugin | ||
174 | * Description: Prepares compressed versions of assets to serve | ||
175 | * them with Content-Encoding | ||
176 | * | 219 | * |
177 | * See: https://github.com/webpack/compression-webpack-plugin | 220 | * See: https://webpack.github.io/docs/configuration.html#node |
178 | */ | 221 | */ |
179 | new CompressionPlugin({ | 222 | node: { |
180 | regExp: /\.css$|\.html$|\.js$|\.map$/, | 223 | global: 'window', |
181 | threshold: 2 * 1024 | 224 | crypto: 'empty', |
182 | }) | 225 | process: false, |
183 | 226 | module: false, | |
184 | ], | 227 | clearImmediate: false, |
185 | 228 | setImmediate: false | |
186 | /** | 229 | } |
187 | * Static analysis linter for TypeScript advanced options configuration | 230 | |
188 | * Description: An extensible linter for the TypeScript language. | 231 | }) |
189 | * | 232 | } |
190 | * See: https://github.com/wbuchwalter/tslint-loader | ||
191 | */ | ||
192 | tslint: { | ||
193 | emitErrors: true, | ||
194 | failOnHint: true, | ||
195 | resourcePath: 'src' | ||
196 | }, | ||
197 | |||
198 | /** | ||
199 | * Html loader advanced options | ||
200 | * | ||
201 | * See: https://github.com/webpack/html-loader#advanced-options | ||
202 | */ | ||
203 | // TODO: Need to workaround Angular 2's html syntax => #id [bind] (event) *ngFor | ||
204 | htmlLoader: { | ||
205 | minimize: true, | ||
206 | removeAttributeQuotes: false, | ||
207 | caseSensitive: true, | ||
208 | customAttrSurround: [ | ||
209 | [/#/, /(?:)/], | ||
210 | [/\*/, /(?:)/], | ||
211 | [/\[?\(?/, /(?:)/] | ||
212 | ], | ||
213 | customAttrAssign: [/\)?\]?=/] | ||
214 | }, | ||
215 | |||
216 | /* | ||
217 | * Include polyfills or mocks for various node stuff | ||
218 | * Description: Node configuration | ||
219 | * | ||
220 | * See: https://webpack.github.io/docs/configuration.html#node | ||
221 | */ | ||
222 | node: { | ||
223 | global: 'window', | ||
224 | crypto: 'empty', | ||
225 | process: false, | ||
226 | module: false, | ||
227 | clearImmediate: false, | ||
228 | setImmediate: false | ||
229 | } | ||
230 | |||
231 | }) | ||