core
core copied to clipboard
Introduce resolveChunk() hook and loadChunk() api in runtime
Currently node federation is implemented as a runtimePlugin, but relies on webpack APIs to hook into chunk loading. This makes Node federation tightly coupled with webpack.
Suggested solution
Introducing new APIs and runtime hooks to tap into chunk loading makes Node federation completely free of webpack.
API and Hooks for chunk loading
- loadChunk()
- loadChunk API will be used to load any chunk exposed by a remote.
- loadChunk will use the appropriate loader to load the chunk
importfor ESMrequirefor CJSrequire(from requirejs) for AMDSystem.importfor SystemJS- NOTE: Using the appropriate loader to handle chunk loading is already taken care by the bundler during output generation phase
- resolveChunk()
- Allows for manual resolution of chunk load requests.
- This runtime hook will be called before a chunk is resolved
- Similar to resolveShare, one can provide an explicit resolver which resolves to a module
Alternative
No response
Additional context
No response
Validations
- [X] Read the Contributing Guidelines.
- [X] Check that there isn't already an issue that request the same feature to avoid creating a duplicate.