Bug Description
- Webpack is setup with
externalsType: 'module-import' and one external: external-lib
- There's the main entrypoint without any dependencies and a
chunk.js file that does import 'external-lib';
- The main entrypoint imports dynamically the chunk -
import('./chunk')
Issue / Actual behaviour
external-lib is hoisted at the top of the main chunk - https://github.com/nkalinov/webpack-externals-chunk-bug/blob/main/dist/main.js#L1
Expected Behavior
external-lib should be hoisted, yes, but at the top of the dynamic chunk that actually depends on it - https://github.com/nkalinov/webpack-externals-chunk-bug/blob/main/dist/1.main.js
Link to Minimal Reproduction and step to reproduce
https://github.com/nkalinov/webpack-externals-chunk-bug/tree/main
Bug Description
externalsType: 'module-import'and one external:external-libchunk.jsfile that doesimport 'external-lib';import('./chunk')Issue / Actual behaviour
external-libis hoisted at the top of the main chunk - https://github.com/nkalinov/webpack-externals-chunk-bug/blob/main/dist/main.js#L1Expected Behavior
external-libshould be hoisted, yes, but at the top of the dynamic chunk that actually depends on it - https://github.com/nkalinov/webpack-externals-chunk-bug/blob/main/dist/1.main.jsLink to Minimal Reproduction and step to reproduce
https://github.com/nkalinov/webpack-externals-chunk-bug/tree/main