Skip to content
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 adding/removing hooks when runtimeChunk is true #25

Closed
mmhand123 opened this issue Dec 18, 2019 · 7 comments · Fixed by #26
Closed

Issue with adding/removing hooks when runtimeChunk is true #25

mmhand123 opened this issue Dec 18, 2019 · 7 comments · Fixed by #26

Comments

@mmhand123
Copy link
Contributor

mmhand123 commented Dec 18, 2019

When runtimeChunks: true is enabled in the webpack config, I'm running into an issue with getting Rendered more hooks than during the previous render. (or less, depending on what hooks get added/removed). To reproduce, add optimization: { runtimeChunks: true } to the webpack config of wds-kitchen-sink, and then add a hook to a functional component, save, and add another, The error should appear.

Edit - what I originally thought was incorrect 😦

@mmhand123
Copy link
Contributor Author

Actually might not be the issue I thought it was. Getting the error to reproduce pretty much always when optimization.runtimeChunks is true. Will try to dig in more tomorrow.

@pmmmwh
Copy link
Owner

pmmmwh commented Dec 18, 2019

I think this might be related to #4

@mmhand123
Copy link
Contributor Author

Ah yeah definitely. Sorry about opening the new issue, wasn't thinking 😅

At least in my config (and the wds-kitchen-sink when I added it) runtimeChunks: true was what was causing the errors to start occurring.

@drather19
Copy link

@mmhand123 thanks a lot for digging this up! I can confirm that setting runtimeChunks: false via craco in my CRA app fixes the issue I was having with adding/removing hooks in #4 earlier.

@pmmmwh
Copy link
Owner

pmmmwh commented Dec 18, 2019

I can confirm that this is reliably reproducible.

I think I also know the culprit, but this will take a bit of time to fix because it is related to how the plugin examine chunks to inject module initialization template conditionally. (createRefreshTemplate.js@L37)

It has to be conditional because some plugins, like the HTMLWebpackPlugin, also bundles html files as javascript/auto modules. If we did the transformation on all chunks passing through the plugin, it will screw up really badly.

@pmmmwh
Copy link
Owner

pmmmwh commented Dec 19, 2019

Fixed in v0.1.3 🎉

@mmhand123
Copy link
Contributor Author

Thank you!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants