diff options
Diffstat (limited to 'client/config/webpack.dev.js')
-rw-r--r-- | client/config/webpack.dev.js | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/client/config/webpack.dev.js b/client/config/webpack.dev.js index 9cf09db0f..8948af9b2 100644 --- a/client/config/webpack.dev.js +++ b/client/config/webpack.dev.js | |||
@@ -11,6 +11,7 @@ const AddAssetHtmlPlugin = require('add-asset-html-webpack-plugin') | |||
11 | const DefinePlugin = require('webpack/lib/DefinePlugin') | 11 | const DefinePlugin = require('webpack/lib/DefinePlugin') |
12 | const NamedModulesPlugin = require('webpack/lib/NamedModulesPlugin') | 12 | const NamedModulesPlugin = require('webpack/lib/NamedModulesPlugin') |
13 | const LoaderOptionsPlugin = require('webpack/lib/LoaderOptionsPlugin') | 13 | const LoaderOptionsPlugin = require('webpack/lib/LoaderOptionsPlugin') |
14 | const HotModuleReplacementPlugin = require('webpack/lib/HotModuleReplacementPlugin') | ||
14 | 15 | ||
15 | /** | 16 | /** |
16 | * Webpack Constants | 17 | * Webpack Constants |
@@ -18,14 +19,18 @@ const LoaderOptionsPlugin = require('webpack/lib/LoaderOptionsPlugin') | |||
18 | const ENV = process.env.ENV = process.env.NODE_ENV = 'development' | 19 | const ENV = process.env.ENV = process.env.NODE_ENV = 'development' |
19 | const HOST = process.env.HOST || 'localhost' | 20 | const HOST = process.env.HOST || 'localhost' |
20 | const PORT = process.env.PORT || 3000 | 21 | const PORT = process.env.PORT || 3000 |
22 | const PUBLIC = process.env.PUBLIC_DEV || HOST + ':' + PORT | ||
23 | const AOT = process.env.BUILD_AOT || helpers.hasNpmFlag('aot') | ||
21 | const HMR = helpers.hasProcessFlag('hot') | 24 | const HMR = helpers.hasProcessFlag('hot') |
22 | const METADATA = webpackMerge(commonConfig({env: ENV}).metadata, { | 25 | const METADATA = { |
23 | host: HOST, | 26 | host: HOST, |
24 | port: PORT, | 27 | port: PORT, |
28 | public: PUBLIC, | ||
25 | ENV: ENV, | 29 | ENV: ENV, |
26 | HMR: HMR, | 30 | HMR: HMR, |
31 | AOT: AOT, | ||
27 | API_URL: 'http://localhost:9000' | 32 | API_URL: 'http://localhost:9000' |
28 | }) | 33 | } |
29 | 34 | ||
30 | const DllBundlesPlugin = require('webpack-dll-bundles-plugin').DllBundlesPlugin | 35 | const DllBundlesPlugin = require('webpack-dll-bundles-plugin').DllBundlesPlugin |
31 | 36 | ||
@@ -125,11 +130,9 @@ module.exports = function (env) { | |||
125 | 'HMR': METADATA.HMR, | 130 | 'HMR': METADATA.HMR, |
126 | 'API_URL': JSON.stringify(METADATA.API_URL), | 131 | 'API_URL': JSON.stringify(METADATA.API_URL), |
127 | 'process.version': JSON.stringify(process.version), | 132 | 'process.version': JSON.stringify(process.version), |
128 | 'process.env': { | 133 | 'process.env.ENV': JSON.stringify(METADATA.ENV), |
129 | 'ENV': JSON.stringify(METADATA.ENV), | 134 | 'process.env.NODE_ENV': JSON.stringify(METADATA.ENV), |
130 | 'NODE_ENV': JSON.stringify(METADATA.ENV), | 135 | 'process.env.HMR': METADATA.HMR |
131 | 'HMR': METADATA.HMR | ||
132 | } | ||
133 | }), | 136 | }), |
134 | 137 | ||
135 | new DllBundlesPlugin({ | 138 | new DllBundlesPlugin({ |
@@ -216,8 +219,9 @@ module.exports = function (env) { | |||
216 | } | 219 | } |
217 | 220 | ||
218 | } | 221 | } |
219 | }) | 222 | }), |
220 | 223 | ||
224 | new HotModuleReplacementPlugin() | ||
221 | ], | 225 | ], |
222 | 226 | ||
223 | /** | 227 | /** |
@@ -232,6 +236,7 @@ module.exports = function (env) { | |||
232 | port: METADATA.port, | 236 | port: METADATA.port, |
233 | host: METADATA.host, | 237 | host: METADATA.host, |
234 | historyApiFallback: true, | 238 | historyApiFallback: true, |
239 | hot: METADATA.HMR, | ||
235 | watchOptions: { | 240 | watchOptions: { |
236 | ignored: /node_modules/ | 241 | ignored: /node_modules/ |
237 | } | 242 | } |