Comments (15)
@aspirisen, take a look at autoRestart. Maybe it will usefull for you.
While I close the issue.
from node-hot-loader.
Adding code to entry file (where you starting server) may help:
if (module.hot) {
// For reload main module (self). It will restart server.
module.hot.accept((err: Error) => console.error('Hot accept error:', err));
module.hot.dispose(() => {
console.log('Disposing entry module...');
// ... other stuff
});
}
But if webpack HMR state is broken you should restart process manually at the moment.
from node-hot-loader.
The problem is that in case of 'module.hot.dispose' the global
object is the same, i need full reload, how to indicate it?
from node-hot-loader.
It's just disposer callback: clear resources, close connections, etc. In 'module.hot.dispose' you steel have old state of all objects in current module. The global
var is the same may be because a node process is not restarted (just hot reloaded some modules, but global scope is not changed). It seems to be how the webpack does its job.
from node-hot-loader.
Yes, and i am looking for a way how to tell node-hot-loader
to do full reload instead of manually i.e. close terminal and open once again
from node-hot-loader.
There is no such feature. May be you don't need hor reload If you need new global scope? May be nodemon it's your choise. Or you should restore global scope manually in dispose callback.
from node-hot-loader.
In general HMR works for me, except updating several files because they are depended on global object.
from node-hot-loader.
You may add dispose
to these files and restore global object as you need.
from node-hot-loader.
It's difficult to discuss without concrete example.
from node-hot-loader.
There is a third party library which provides decorators and this library uses global object to store decorators' data. This library is in node_modules so hmr doesn't affect it, change or reset global object i can't because the behavior becomes unpredictable, it would be good to have fallback option to reload the whole bundle
from node-hot-loader.
Try to add a whatcher (nodemod, webpack plugin or something else) for these files and restart whole process.
from node-hot-loader.
Ok, could you tell how to restart the process from bundle script?
from node-hot-loader.
process.exit and the same way you start it.
Stack overflow can help you.
from node-hot-loader.
Why not to add this feature to 'node-hot-loader' as i remember i.e. hmr will reload browser page in case of emergency
from node-hot-loader.
PR welcome! )
from node-hot-loader.
Related Issues (18)
- can you create an example app? HOT 1
- Unable to use .ts extension for webpack config HOT 5
- Can I not write to disk? HOT 6
- Support for multiple configurations HOT 2
- Not working with Webpack 5 HOT 1
- HELP ME - how to use HMR view engine pug HOT 4
- autoRestart not work HOT 3
- Auto-restart stops working when file is changed twice HOT 4
- Can't install in development mode HOT 2
- babel node HOT 2
- Sourcemap/debug breakpoint support HOT 8
- Error when using with socket.io HOT 6
- DeprecationWarning: Tapable.plugin HOT 2
- Question: How to HMR React Front End and Express Backend? HOT 2
- Silent mode HOT 2
- Invalid Configuration Object HOT 2
- Is it possible to run node with --inspect-brk? HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from node-hot-loader.