-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
[improvement] split external modules in dynamic imports #2854
Comments
Wait, did you mean If you're expecting code splitting, please use the real splitting option ( |
no, the problem is not it compiled into the commonjs I target Esnext and use
I want all external modules to be splitted regardless of the splitting flag. |
I'm not totally sure what you're saying. I don't think you actually mean "external". Setting something as "external" means "don't bundle this" but it seems like you actually do want these to be bundled, just put in separate chunks? After reading what you wrote, my best guess as to what you're asking is that you want to enable esbuild's code splitting but have more control over code splitting chunk boundaries. So then this would be a duplicate of #207 perhaps. |
no, I meen don't bundle it at all |
Please provide a self-contained way to reproduce the issue. |
I’m closing this issue because a way to reproduce it was not provided. |
when you add './module' into the externals array and then importing it dynamically (or even statically) like this
import('./module')
it compiled into
Promise.resolve()
instead of a real dynamic import.as per the docs, this is an intended behavior, so this is not an issue report.
but this has some drawbacks, especially if the imported module includes a singleton reference.
what's wrong with this behavior?
undefined
, even after reviewing the code carefully and the setup of esbuild and the externals arrayas a dirty work arround we can do
import(`${'./module'}`)
, but it also has drowbacks.as a rule of thumb, if the imported module matches an external flag, split the code even if it is analyzable.
The text was updated successfully, but these errors were encountered: