diff options
Diffstat (limited to 'client/config')
-rw-r--r-- | client/config/webpack.common.js | 2 | ||||
-rw-r--r-- | client/config/webpack.dev.js | 50 |
2 files changed, 51 insertions, 1 deletions
diff --git a/client/config/webpack.common.js b/client/config/webpack.common.js index 09d6f72b5..223f55c2e 100644 --- a/client/config/webpack.common.js +++ b/client/config/webpack.common.js | |||
@@ -323,7 +323,7 @@ module.exports = function (options) { | |||
323 | * See: https://webpack.github.io/docs/configuration.html#node | 323 | * See: https://webpack.github.io/docs/configuration.html#node |
324 | */ | 324 | */ |
325 | node: { | 325 | node: { |
326 | global: 'true', | 326 | global: true, |
327 | crypto: 'empty', | 327 | crypto: 'empty', |
328 | process: true, | 328 | process: true, |
329 | module: false, | 329 | module: false, |
diff --git a/client/config/webpack.dev.js b/client/config/webpack.dev.js index 054757748..affb20f19 100644 --- a/client/config/webpack.dev.js +++ b/client/config/webpack.dev.js | |||
@@ -1,10 +1,12 @@ | |||
1 | const helpers = require('./helpers') | 1 | const helpers = require('./helpers') |
2 | const webpackMerge = require('webpack-merge') // used to merge webpack configs | 2 | const webpackMerge = require('webpack-merge') // used to merge webpack configs |
3 | const webpackMergeDll = webpackMerge.strategy({plugins: 'replace'}) | ||
3 | const commonConfig = require('./webpack.common.js') // the settings that are common to prod and dev | 4 | const commonConfig = require('./webpack.common.js') // the settings that are common to prod and dev |
4 | 5 | ||
5 | /** | 6 | /** |
6 | * Webpack Plugins | 7 | * Webpack Plugins |
7 | */ | 8 | */ |
9 | const AddAssetHtmlPlugin = require('add-asset-html-webpack-plugin') | ||
8 | const DefinePlugin = require('webpack/lib/DefinePlugin') | 10 | const DefinePlugin = require('webpack/lib/DefinePlugin') |
9 | const NamedModulesPlugin = require('webpack/lib/NamedModulesPlugin') | 11 | const NamedModulesPlugin = require('webpack/lib/NamedModulesPlugin') |
10 | const LoaderOptionsPlugin = require('webpack/lib/LoaderOptionsPlugin') | 12 | const LoaderOptionsPlugin = require('webpack/lib/LoaderOptionsPlugin') |
@@ -23,6 +25,8 @@ const METADATA = webpackMerge(commonConfig({env: ENV}).metadata, { | |||
23 | HMR: HMR | 25 | HMR: HMR |
24 | }) | 26 | }) |
25 | 27 | ||
28 | const DllBundlesPlugin = require('webpack-dll-bundles-plugin').DllBundlesPlugin | ||
29 | |||
26 | /** | 30 | /** |
27 | * Webpack configuration | 31 | * Webpack configuration |
28 | * | 32 | * |
@@ -106,6 +110,52 @@ module.exports = function (env) { | |||
106 | } | 110 | } |
107 | }), | 111 | }), |
108 | 112 | ||
113 | new DllBundlesPlugin({ | ||
114 | bundles: { | ||
115 | polyfills: [ | ||
116 | 'core-js', | ||
117 | { | ||
118 | name: 'zone.js', | ||
119 | path: 'zone.js/dist/zone.js' | ||
120 | }, | ||
121 | { | ||
122 | name: 'zone.js', | ||
123 | path: 'zone.js/dist/long-stack-trace-zone.js' | ||
124 | }, | ||
125 | 'ts-helpers' | ||
126 | ], | ||
127 | vendor: [ | ||
128 | '@angular/platform-browser', | ||
129 | '@angular/platform-browser-dynamic', | ||
130 | '@angular/core', | ||
131 | '@angular/common', | ||
132 | '@angular/forms', | ||
133 | '@angular/http', | ||
134 | '@angular/router', | ||
135 | '@angularclass/hmr', | ||
136 | 'rxjs' | ||
137 | ] | ||
138 | }, | ||
139 | dllDir: helpers.root('dll'), | ||
140 | webpackConfig: webpackMergeDll(commonConfig({env: ENV}), { | ||
141 | devtool: 'cheap-module-source-map', | ||
142 | plugins: [] | ||
143 | }) | ||
144 | }), | ||
145 | |||
146 | /** | ||
147 | * Plugin: AddAssetHtmlPlugin | ||
148 | * Description: Adds the given JS or CSS file to the files | ||
149 | * Webpack knows about, and put it into the list of assets | ||
150 | * html-webpack-plugin injects into the generated html. | ||
151 | * | ||
152 | * See: https://github.com/SimenB/add-asset-html-webpack-plugin | ||
153 | */ | ||
154 | new AddAssetHtmlPlugin([ | ||
155 | { filepath: helpers.root(`dll/${DllBundlesPlugin.resolveFile('polyfills')}`) }, | ||
156 | { filepath: helpers.root(`dll/${DllBundlesPlugin.resolveFile('vendor')}`) } | ||
157 | ]), | ||
158 | |||
109 | /** | 159 | /** |
110 | * Plugin: NamedModulesPlugin (experimental) | 160 | * Plugin: NamedModulesPlugin (experimental) |
111 | * Description: Uses file names as module name. | 161 | * Description: Uses file names as module name. |