-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue with solid-refresh plugin and HMR #213
Comments
Sounds like |
You need to remove |
It works if used in non-esm mode, but although I get HMR notifications, HMR does not refresh the page. I removed module.hot from my config, to make sure that I'm not using Hot Reload. HMR is working with simillar Webpack configuration.
|
Not entirely sure what you mean. Seems to work just fine for me. If I modify |
IHuh - my bad, I commented out Hot Reload for main page, thinking that would also be automated. Is that the proper way, then? Leave Hot Reload for main page and the components will do HMR? |
Calling accept by itself will do nothing. This does differ in behaviour from other bundlers but it is an intentional design choice. Rather than automatically assuming the developer wants to reload, I make the developer explicit opt into that behaviour which feels less ambiguous. Usually there is no need for a developer to add any code when using a plugin, but what you described is perfectly fine in terms of implementation anyways. |
The issue with this is that everything reloads - if I have a nested component, and update only it's state - the parent should not reload it's state, but it does. So, if I'm calling reload from accept, there's no HMR, because everything reloads, and if I remove module.hot.accept, HMR shows in the console, but it's not updating the browser. I have a similar sample, but with Webpack, and there the hot module reload works as it should, and doesn't require additional instructions. The aim is to update this sample to be on par with that one. |
Ahhh I see what you mean now. I didn't notice it was actually refreshing the page. Let me have another look. |
Found the problem, but not entirely sure what the correct answer is yet. The way that
For compatibility with Nollup, it needs to do something like this instead (not the exact code, the Babel transform also needs to be updated):
Solid Refresh can be updated to support this, and in theory I don't think it will break Parcel or Webpack. I need to look more into this to see if this is something that Nollup can handle internally, as implementing the assumptions |
This PR contains the changes required, but still needs further testing: #214 |
Thanks, those changes work as expected - seamless HMR :D. Looking forward to #214 being merged! |
So unfortunately as suspected, this is a breaking change. The way that the Not entirely sure how to approach this. If I don't implement the change, one project has to update their code. If I do implement the change, another project has to update their code. Could implement a flag in |
https://github.com/PepsRyuu/nollup/pull/214/files Updated the PR so that if you call |
After further testing, we're good to go with this compromise approach. Released in |
Thanks a lot! |
I'm having issues with solid-js solid-refresh plugin - trying to make HMR work. The plugin works using babel, so I'm adding it to the plugins list, like this:
Nollup starts and compiles everything, but trying to load the page I'm getting:
I'm not sure what to do at this point - any suggestions? The code is here - https://github.com/high1/solid-typescript-rollup nollup/hmr branch.
The text was updated successfully, but these errors were encountered: