Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // webpack.config.js
- module.exports = {
- ...
- target: 'node'
- ...
- }
- // webpack.config.js
- module.exports = {
- ...
- plugins: [new webpack.HotModuleReplacementPlugin()]
- ...
- };
- // webpack.config.js
- module.exports = {
- ...
- entry: [
- 'webpack/hot/poll?1000', // This differs from client side HMR
- 'app.js'
- ]
- ...
- };
- // app.js
- let config = require('./config');
- setInterval(() => {
- console.log(config.FOO_BAR);
- }, 2000);
- // NOTE: This would need to be done everywhere you use './config' so you might want to create a loader to generate it.
- if (module.hot) {
- module.hot.accept('./config', () => {
- let config = require('./config');
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement