-
Notifications
You must be signed in to change notification settings - Fork 3
Description
Thanks for building this plugin.
I would like to use this plugin in a library.
However, prefetching / preloading chunks from an expected path is not really suitable for libraries because the library might be bundled again by the consuming project, moving or renaming chunks.
Therefore an option to hoist dependencies of a dynamic import as dynamic imports themselves would be great.
As dynamic imports they can be processed by the consuming project's bundler without problems, be it rollup or webpack.
For example a dynamic import of lib lazy-chunk.js with dependency 'lazy-dependency.js' which is imported as:
import('./lazy-chunk');could become:
[import('./lazy-dependency'), import('./lazy-chunk')][1]Note that these are imports with file paths as simple strings on purpose which can be easily processed by subsequent bundlers, not imports on paths specified in variables or complicated method invocations.
What do you think about having this feature?