Skip to content
This repository was archived by the owner on Aug 7, 2021. It is now read-only.

Commit 4c3be66

Browse files
committed
refactor: add --env.hmr options to templates
1 parent 2767f91 commit 4c3be66

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed

templates/webpack.angular.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ module.exports = env => {
4242
uglify, // --env.uglify
4343
report, // --env.report
4444
sourceMap, // --env.sourceMap
45+
hmr, // --env.hmr
4546
} = env;
4647

4748
const appFullPath = resolve(projectRoot, appPath);
@@ -265,5 +266,9 @@ module.exports = env => {
265266
}));
266267
}
267268

269+
if (hmr) {
270+
config.plugins.push(new HotModuleReplacementPlugin());
271+
}
272+
268273
return config;
269274
};

templates/webpack.javascript.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ module.exports = env => {
4040
uglify, // --env.uglify
4141
report, // --env.report
4242
sourceMap, // --env.sourceMap
43+
hmr, // --env.hmr
4344
} = env;
4445

4546
const appFullPath = resolve(projectRoot, appPath);
@@ -227,5 +228,10 @@ module.exports = env => {
227228
}));
228229
}
229230

231+
if (hmr) {
232+
config.plugins.push(new HotModuleReplacementPlugin());
233+
}
234+
235+
230236
return config;
231237
};

templates/webpack.typescript.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ module.exports = env => {
4040
uglify, // --env.uglify
4141
report, // --env.report
4242
sourceMap, // --env.sourceMap
43+
hmr, // --env.hmr
4344
} = env;
4445

4546
const appFullPath = resolve(projectRoot, appPath);
@@ -237,5 +238,10 @@ module.exports = env => {
237238
}));
238239
}
239240

241+
if (hmr) {
242+
config.plugins.push(new HotModuleReplacementPlugin());
243+
}
244+
245+
240246
return config;
241247
};

0 commit comments

Comments
 (0)