jaredpalmer / razzle

✨ Create server-rendered universal JavaScript applications with no configuration
https://razzlejs.org
MIT License
11.1k stars 866 forks source link

How to hot reload on non .js files? #350

Closed WolfDan closed 7 years ago

WolfDan commented 7 years ago

I'm making a SSR app with Elm and Razzle, everything is fine, I just need to make work HMR with all .elm files.

Actually I can make hot reload to specific files, like this:

if (module.hot) {
  module.hot.accept();
  module.hot.accept('./Main', () => {
    const nextElm = require('./Main').Main;
    nextElm.embed( document.getElementById( "root" ) );
  })
}

If I change the code of Main.elm it hot reload, but if I edit any other child elm file it dosen't work. Is really annoying add every file (much more if the project is big) so I wan't to know if is possible reload on all .elm files

Greetings


Sorry if my English writing skills are poor, I still learning ^^'

WolfDan commented 7 years ago

Solved, if you're curious how to make work Elm and Razzle take a look to this repo

jaredpalmer commented 7 years ago

Want to submit a PR to make this an official Razzle example?

WolfDan commented 7 years ago

Sure @jaredpalmer !

edit: PR created

jaredpalmer commented 7 years ago

Examples folder so people can install it with the CLI. I will add a link to the initial repo in the readme in the example too

WolfDan commented 7 years ago

@jaredpalmer I just created the pull request in the example folder ^^