Dynamic imports wrongly loads static import dependencies inside packages #9182
Labels
confirmed
We want to fix or implement it
Impact:some
in-development
We are already working on it
Type:Bug
Milestone
When you use
import()
to dynamically import a file, you would expect that all of that file's staticimport
s would also be loaded dynamically. In other words, if I load this file dynamically:Then
SuperHeavyJSPackage
will not be part of my app bundle.While this works fine inside the
imports
directory, it seems like it doesn't inside thepackages
directory. What's more, apparently imports will run even when they shouldn't (for example, inside anif (false) {...}
block).Here's a reproduction I created with help from @Discordius, who found the issue:
https://github.com/SachaG/dynamic-imports-bug/tree/package
And here's the same code running out of
imports
to compare:https://github.com/SachaG/dynamic-imports-bug/tree/imports
It seems like the problem has been around since 1.5 as far as I can tell.
The text was updated successfully, but these errors were encountered: