-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Calling this.addWatchFile
in load
hook throws an error if manualChunks is used
#5260
Comments
Yes I see. I fear this is a tricky edge case that was not properly considered for manual chunks. The problem is that watchFiles that are added during the generate phase would be ignored. We could avoid throwing an error as it would also not be a problem, I am just not sure we should. Maybe we could avoid throwing an error if they are added in a hook that usually runs in the build phase, or at least for the load hook. |
I think this is safe to do and this matches my intuition the most. Because IIUC other build phase hooks (e.g. The only problem I can think of is this: when
, will editing |
Probably not. On the other hand looking at the code, I think there is no reason not to update watchFiles in the CLI AFTER the generate phase. That would remove this restriction entirely. Might be another two days before I can look into this, though. |
Fix at #5270 |
This issue has been resolved via #5270 as part of rollup@4.6.0. You can test it via |
I'm not sure if this is a bug. In the documentation,
this.addWatchFile
is allowed to be called in the build phase, i.e.load
hook.But actually
load
hook is called in the generate phase (e.g. when manualChunks is used (addAdditionalModules
)). So callingthis.addWatchFile
unconditionally will throw an error in that case. The error happens with both 4.5.0 and 3.29.4.Reproduction: https://stackblitz.com/edit/rollup-repro-zyzeva?file=rollup.config.js
Should I add a
if
condition like this?The text was updated successfully, but these errors were encountered: