Comments (6)
@gaearon perhaps you can see what i'm doing wrong here?
from universal-redux.
Just to clarify.. Webpack analyzes module.hot.accept()
calls at compile time. Both require()
and module.hot.accept()
need to have paths hard-coded there for hot reloading to work (as far as I know). I don't think it works with dynamic paths, no matter what you use to calculate them. Did it work before with dynamic paths for you?
from universal-redux.
@gaearon i don't think it ever worked with dynamic paths, no. the original didn't need to because all of its reducers lived in a ./modules/index
path relative to where the store was created. my situation is somewhat different because i'm configuring webpack to build a bundle from the project root (via contextRoot
and some webpack aliases) that includes this library as a dependency and has access to both ./src
as well as ./node_modules/universal-redux/src
I've noticed that if I put the following in my setup:
module.hot.accept('redux/modules/index', function () {
console.log('replacing reducer in project...');
store.replaceReducer(require('redux/modules/index'));
});
module.hot.accept('./modules/index', function () {
console.log('replacing reducer in universal-redux...');
store.replaceReducer(require('./modules/index'));
});
It will hot reload the modules/test
reducer relative to universal-redux, but not the redux/modules/index
reducer relative to the project root. The console output after changing both files is:
[HMR] connected
[HMR] bundle rebuilding
[HMR] bundle rebuilt in 458ms
[HMR] Checking for updates on the server...
replacing reducer in universal-redux...
[HMR] Updated modules:
[HMR] - ./~/universal-redux/lib/redux/modules/index.js
[HMR] App is up to date.
[HMR] bundle rebuilding
[HMR] bundle rebuilt in 498ms
[HMR] Checking for updates on the server...
[HMR] The following modules couldn't be hot updated: (Full reload needed)
[HMR] - ./src/redux/modules/index.js
It's as if the accept route is not being mapped correctly.
from universal-redux.
This issue still remains, but I've noticed that it occurs in react-redux-universal-hot-example too, in the same circumstances. I'm not sure I fully understand when a change to a reducer module is 'reloadable', and need to put together some steps that are reproducible. For example, either in universal-redux or in react-redux-universal-hot-example, adding a new property to the initialState
appears to fail hot reloading with reducers that have already been initialized.
from universal-redux.
Please file an issue with DevTools with instructions to reproduce.
from universal-redux.
The commit that fixed this is here: 436d748
What is not clear to me is why the import of reducers from a webpack alias, even if not used, would itself break hot reloading. All the way from initial client entry to the point where module.hot.accept is assigned, modules are required to be loaded via relative paths, or else modules fail to hot reload.
from universal-redux.
Related Issues (20)
- onEnter can't redirect HOT 1
- How to access external server api (rails or laravel ... etc) from universal-redux?
- [webpack-isomorphic-tools] (waiting for the first Webpack build to finish)
- how the server side API requests handle the jwt token?
- Move to redux-connect HOT 1
- Help required?
- Question about waiting for Server Requests HOT 1
- Question about โAdd routes, reducer and rootClientComponent aliases so that client has access to themโ HOT 5
- Setting scroll behavior for the router
- SVG Loading Configuration
- Different CSS idents cause server render to be discarded HOT 1
- Using npm dependencies listed in Universal-redux on the project level HOT 3
- [webpack-isomorphic-tools] asset not found HOT 9
- Question: how to alter the JS loader HOT 4
- Passing Express request headers to Html component?
- @@router/UPDATE_LOCATION fired after first dispatched action HOT 3
- Server-side React render was discarded HOT 5
- Use redux-devtools-extension HOT 1
- integrate HappyPack
- should user other way to compile es6-7 with babel
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 universal-redux.