-
Notifications
You must be signed in to change notification settings - Fork 5.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
Add option to code split dynamic imports in bundles #5562
Comments
|
I'd imagine this is actually quite relevant for the server use case as well, not for "applications" but for reusable libraries. Beyond a certain library size it's pretty common practice to split it up into sub-modules, some of which may indeed still depend on each other, but with the difference that the consumer of the library has the option to only import the sub-modules he needs. This is IMHO an important feature for publishing libraries, if you want to truly avoid the need for additional build tooling. It wouldn't have to be limited to dynamic imports, of course - just like with webpack it should be possible to specify multiple entry points as a list of files. |
@mischkl there is nothing preventing someone from creating I can see the point about potentially not bundling bundles, and simply leaving them as an external import, as well as supporting a more complex dependency analysis so that |
I think enhancing the compiler api for My expectations would be that |
As of 1.5, dynamic imports are no longer inlined under any conditions and bundles are simply ESM files, so they become really difficult to detect as a unique file. So effectively it is up to the end user to figure out if they want to |
I suspect this is probably out of scope given Deno appears to be only targeting server runtimes where this matters less, but it would be great for web usage if Deno's bundle command had an option to code split for dynamic imports. Without this feature, we'll likely see a webpack equivalent for Deno. It would be unfortunate to have separate bundlers for targeting server vs web. Additionally, servers can benefit from faster startup times if dynamic imports were code split.
The text was updated successfully, but these errors were encountered: