Giter Site home page Giter Site logo

Comments (17)

glenjamin avatar glenjamin commented on August 20, 2024

I've never used image loading via require myself - but hopefully someone else can chime in with an answer!

from ultimate-hot-reloading-example.

adri avatar adri commented on August 20, 2024

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.

adri avatar adri commented on August 20, 2024

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.

glenjamin avatar glenjamin commented on August 20, 2024

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.

tomatau avatar tomatau commented on August 20, 2024

@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.

adri avatar adri commented on August 20, 2024

@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.

adri avatar adri commented on August 20, 2024

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.

adri avatar adri commented on August 20, 2024

Found the issue. catamphetamine/webpack-isomorphic-tools#6

from ultimate-hot-reloading-example.

tomatau avatar tomatau commented on August 20, 2024

nice work @adri 👍

from ultimate-hot-reloading-example.

tomatau avatar tomatau commented on August 20, 2024

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.

adri avatar adri commented on August 20, 2024

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.

tomatau avatar tomatau commented on August 20, 2024

@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.

adri avatar adri commented on August 20, 2024

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.

kevinsimper avatar kevinsimper commented on August 20, 2024

There is a module like css-require 😄

https://www.npmjs.com/package/images-require-hook

from ultimate-hot-reloading-example.

tomatau avatar tomatau commented on August 20, 2024

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.

kevinsimper avatar kevinsimper commented on August 20, 2024

@tomatau nice and do you have an example that would fit into this repo?

from ultimate-hot-reloading-example.

tomatau avatar tomatau commented on August 20, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.