Skip to content
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

Introduce resolveChunk() hook and loadChunk() api in runtime #3260

Open
2 tasks done
MadaraUchiha-314 opened this issue Nov 20, 2024 · 0 comments
Open
2 tasks done

Introduce resolveChunk() hook and loadChunk() api in runtime #3260

MadaraUchiha-314 opened this issue Nov 20, 2024 · 0 comments

Comments

@MadaraUchiha-314
Copy link
Contributor

MadaraUchiha-314 commented Nov 20, 2024

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

  1. loadChunk()
    • loadChunk API will be used to load any chunk exposed by a remote.
    • loadChunk will use the appropriate loader to load the chunk
      • import for ESM
      • require for CJS
      • require (from requirejs) for AMD
      • System.import for SystemJS
      • NOTE: Using the appropriate loader to handle chunk loading is already taken care by the bundler during output generation phase
  2. 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

  • Read the Contributing Guidelines.
  • Check that there isn't already an issue that request the same feature to avoid creating a duplicate.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants