aitoroses / vulcanize-loader

Polymers vulcanize tool loader for webpack
24 stars 8 forks source link

Doesn't seem to work with hot module replacement for imports #11

Open knewter opened 7 years ago

knewter commented 7 years ago

The problem

When using this in the polymer branch's style, and dealing with styles, you have to refresh the entire webpack server in order to see any changes take place :(

Towards a solution?

I've forked the polymer example and made a slight modification to show what I'm trying to do:

https://github.com/knewter/elm-webpack-starter/tree/polymer_hot

If you run that, there's a theme file that makes the background red. For ideal style development, it would be nice if hot module replacement were supported (even for 'imported' files), so that when you changed the theme file the browser updated accordingly.

I made the loader sort of kind of try to work with hot module replacement. I have no idea what remains to be done or if this is stupid, and I did it against the transpiled code, but you can find it here: https://github.com/knewter/elm-webpack-starter/blob/polymer_hot/loader.js#L359-L381

I'm not sure what could be done to make this work but at present working on a project that uses this is pretty unfortunate when dealing with styling because the feedback loop requires me to restart the webpack server every single time to take the changes :( (though technically I can explicitly change the actual webpack required file and then refresh - still breaks HMR)

I was wondering if you wanted to pair to see what or if we could work through it. Otherwise, I'll look at it later I'm sure. Just wanted to write this up while it was fresh on my mind. Thanks for the software!

aitoroses commented 7 years ago

As we talked @knewter, the refresh that @caleblloyd implemented in #2 might be a workaround but still I have to find a way to make the HMR work!

There's still a small limitation in webcomponents.