https://github.com/webpack/hot-node-example
Example for HMR in a node.js process
https://github.com/webpack/hot-node-example
Last synced: 4 months ago
JSON representation
Example for HMR in a node.js process
- Host: GitHub
- URL: https://github.com/webpack/hot-node-example
- Owner: webpack
- Archived: true
- Created: 2015-05-20T08:38:49.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2015-05-20T08:38:58.000Z (over 10 years ago)
- Last Synced: 2024-10-29T14:57:58.704Z (over 1 year ago)
- Language: JavaScript
- Size: 83 KB
- Stars: 54
- Watchers: 5
- Forks: 14
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# hot-node-example
Example for very simple Hot Module Replacement with webpack.
## Running the app with HMR
```
npm install
npm run hot
# in a new terminal
npm start
```
## Running the app without HMR
```
npm run build
npm start
```
## Real app
In a real application you should do this things too:
* Put any normal node.js module in `externals` config
* For performance
* Not all node.js modules can be bundled
* Specify `output.libraryTarget: "commonjs2"` to default to import by require.
* Use `webpack/hot/signal` instead of polling
* Send a signal to the process to trigger the HMR
* Enable SourceMaps and source-map-support for node.js
* Handle the case when a hot update fails, i. e. because of errors or not accepted modules