Comments (5)
I think this thread has demonstrated that there's value in converting to ES6 module syntax for the static parts, to demonstrate the mix - looks like I was wrong in the other PR.
If you fancy sending that change over again @lucascosta I'll get it merged - otherwise I'll try and get around to it myself some time.
Sorry!
from ultimate-hot-reloading-example.
Thanks @lucascosta! After a bit of tinkering, I eventually arrived at an almost identical version to yours and now I'm hot-reloading like a champ! I want to add in some bits and pieces like react-router
and Immutable.js
as well as the ability to load images via webpack
and fetch data asynchronously - I'll post the resulting repo if I feel that it adds value to what is already out there.
@glenjamin - I'm not a fan of the CommonJS require
/ module.exports
syntax compared to the ES6 equivalent however, in this case it actually enhances readability by establishing a handy convention that makes it is easy to recognize which parts of the app should be loaded dynamically.
Thanks again to both of you. Happy hot loading!
from ultimate-hot-reloading-example.
As babel compiles ES6 modules into require function calls, I find the simplest way to approach this is to use the require() function in any locations which need to be dynamic.
In this case it is the following two calls:
https://github.com/glenjamin/ultimate-hot-reloading-example/blob/master/server.js#L23
https://github.com/glenjamin/ultimate-hot-reloading-example/blob/master/server.js#L28
Once Node has figured out its ES6 modules story and we know how live bindings will work, this might be doable in a different way.
Making a webpack bundle for the server code is certainly an option, but the goal of this project is explicitly to avoid that, so you'll have to look elsewhere for guidance on how to make that work.
from ultimate-hot-reloading-example.
Cheers for the quick response! Seems that the store
and reducers
would also need to implement CommonJS-style module.exports
since these are also loaded dynamically within the dependency tree for client/render-server.js
.
I'll try running the server code through webpack and if that doesn't work cleanly, then I might just hold tight until the HMR landscape settles down a bit.
Thanks again for your help!
from ultimate-hot-reloading-example.
@andy-mcdonald, I have made the move to ES6 syntax in my fork https://github.com/lucascosta/ultimate-hot-reloading-example, maintaining require
where needed for the hot reloading.
from ultimate-hot-reloading-example.
Related Issues (20)
- PostCSS Not Being Used? HOT 3
- server reload can not work on windows HOT 6
- Mysterious babel error HOT 6
- Flash of style on start up HOT 6
- Express routes not reloading HOT 7
- Working on Koa2? HOT 6
- Is this deprecated? HOT 2
- Sass live reload? HOT 1
- Mongoose bug: schema already defined HOT 3
- Consider isomorphic-webpack
- This isn't hot reloading. This is going to the browser and refreshing HOT 1
- How we can use this trick with sass files? HOT 1
- Example with Webpack 2.X
- Integrate VSCode debugging for both client and server side
- npm run start fails on Debian 9
- Figure out exactly what file has been changed instead of clear all cache HOT 2
- Cannot "hot-reload" for the server side/express related stuffs
- Webpack 4?
- Has any example about many components and pages? HOT 2
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 ultimate-hot-reloading-example.