Comments (17)
I've never used image loading via require
myself - but hopefully someone else can chime in with an answer!
from ultimate-hot-reloading-example.
https://github.com/petehunt/webpack-require looks interesting. If this works we could ditch the css-modules-require-hook
. @tomatau What do you think?
from ultimate-hot-reloading-example.
The css-modules-require-hook
is nice but a bit limited to only providing css-modules. Would be nice to just reuse the same webpack config actually.
from ultimate-hot-reloading-example.
It's possible to build a webpack bundle for the server and require that, but it does take a bit longer to apply the change.
See webpack-contrib/webpack-hot-middleware#1 for an example
from ultimate-hot-reloading-example.
@adri Personally I've been attempting to use import from
or the standard require
where possible and avoiding custom require functions.
https://github.com/halt-hammerzeit/webpack-isomorphic-tools has allowed me to do this quite comfortably although the module filter function for some assets can get a little messy. It supports one webpack config for both client and server compile and can be extended for more asset types.
from ultimate-hot-reloading-example.
@tomatau Thanks! I integrated webpack-isomorphic-tools in the ultimate-hot-reloading-example and it works well for loading assets, also with css-modules. It also allows us to only use webpack for client and server rendering which is very neat.
There is only one issue left before I could make a pull request. When there was an error while parsing a file (for example a CSS file) the node process seems to not respond anymore. Not sure yet why. master...adri:webpack-isomorphic-tools
from ultimate-hot-reloading-example.
Did anyone of you experience problems that the node process gets stuck after a syntax error in the parsed code using webpack? I'm not sure how to debug it.
PS: Got hot reloading working with external connections like databases. Thats another pull request.
from ultimate-hot-reloading-example.
Found the issue. catamphetamine/webpack-isomorphic-tools#6
from ultimate-hot-reloading-example.
nice work @adri 👍
from ultimate-hot-reloading-example.
I've built a react & redux universal starter-kit/boilerplate heavily based on the examples of this repo along with universal image handling.
Check it out:
https://github.com/tomatau/breko-hub
Thanks again for this repo, it's been great to learn from whilst building that ^
from ultimate-hot-reloading-example.
I'm experimenting now with running mocha tests after clearing the require caches, all in the same process.
Pretty sweet so far.
from ultimate-hot-reloading-example.
@adri can you share? I'm looking to add test runners to breko-hub so would be interesting to look at your setup
from ultimate-hot-reloading-example.
Yeah https://gist.github.com/adri/7d5127d03ce5ba3e7531#file-hotreload-js-L59
At the moment it is only one test, I'll add a glob
soon – it's still 'in development'.
from ultimate-hot-reloading-example.
There is a module like css-require
https://www.npmjs.com/package/images-require-hook
from ultimate-hot-reloading-example.
I've been using this https://github.com/tomatau/node-hook-filename
Works for any require type and allows you to specify how to deal with the file.
from ultimate-hot-reloading-example.
@tomatau nice and do you have an example that would fit into this repo?
from ultimate-hot-reloading-example.
I use it in my boilerplate when running tests
https://github.com/tomatau/breko-hub/blob/master/test/node-setup.js#L20
I use webpack-isomorphic-tools for images on the server render though
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
- Issue when converting to ES6 Module syntax HOT 5
- 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.