core icon indicating copy to clipboard operation
core copied to clipboard

feat(enhanced): fully hoisted runtime

Open ScriptedAlchemy opened this issue 1 year ago • 2 comments

Description

implement custom tappable hooks for easier cross plugin communication

Related Issue

  • Introducing a new "FederationModulesPlugin" that provides custom hooks for adding container entry modules, retrieving the federation runtime module, and adding the federation runtime module.
  • Enhancing the "ContainerEntryDependency" and "ContainerEntryModule" classes to support additional configuration options through an "experiments" parameter, enabling more customization and flexibility.
  • Updating the "ContainerPlugin" and related classes to leverage the new "FederationModulesPlugin" and its custom hooks, improving the management of container entry modules and the federation runtime.
  • Simplifying the "MfStartupChunkDependenciesPlugin" by removing unnecessary federation runtime-related logic, streamlining the startup process.
  • Introducing a new "InvertedContainerPlugin" in the "nextjs-mf" package, which extends the functionality of the existing "EmbeddedContainerPlugin" and implements the custom tappable hooks for easier cross-plugin communication.

Types of changes

  • [ ] Docs change / refactoring / dependency upgrade
  • [ ] Bug fix (non-breaking change which fixes an issue)
  • [ ] New feature (non-breaking change which adds functionality)

Checklist

  • [ ] I have added tests to cover my changes.
  • [ ] All new and existing tests passed.
  • [ ] I have updated the documentation.

ScriptedAlchemy avatar Sep 07 '24 23:09 ScriptedAlchemy

🦋 Changeset detected

Latest commit: ea0183fd02427534377f5aea4807b86f5890e613

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 38 packages
Name Type
@module-federation/data-prefetch Patch
@module-federation/nextjs-mf Minor
@module-federation/runtime Patch
@module-federation/enhanced Patch
@module-federation/sdk Patch
@module-federation/devtools Patch
@module-federation/dts-plugin Patch
@module-federation/node Patch
@module-federation/retry-plugin Patch
@module-federation/runtime-tools Patch
@module-federation/webpack-bundler-runtime Patch
@module-federation/modern-js Patch
3008-runtime-remote Patch
host Patch
host-v5 Patch
host-vue3 Patch
remote1 Patch
remote2 Patch
remote3 Patch
remote4 Patch
@module-federation/modernjs Patch
@module-federation/esbuild Patch
@module-federation/managers Patch
@module-federation/manifest Patch
@module-federation/rspack Patch
@module-federation/utilities Patch
@module-federation/bridge-react-webpack-plugin Patch
modernjs-ssr-dynamic-nested-remote Patch
modernjs-ssr-dynamic-remote-new-version Patch
modernjs-ssr-dynamic-remote Patch
modernjs-ssr-host Patch
modernjs-ssr-nested-remote Patch
modernjs-ssr-remote-new-version Patch
modernjs-ssr-remote Patch
@module-federation/third-party-dts-extractor Patch
@module-federation/bridge-react Patch
@module-federation/bridge-vue3 Patch
@module-federation/bridge-shared Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

changeset-bot[bot] avatar Sep 07 '24 23:09 changeset-bot[bot]

Deploy Preview for module-federation-docs ready!

Name Link
Latest commit ea0183fd02427534377f5aea4807b86f5890e613
Latest deploy log https://app.netlify.com/sites/module-federation-docs/deploys/66f264c8f871710008e7da55
Deploy Preview https://deploy-preview-2932--module-federation-docs.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

netlify[bot] avatar Sep 07 '24 23:09 netlify[bot]

To active this feature, is there anything else required other than adding this to the plugin configuration?

experiments: {
    federationRuntime: 'hoisted'
}

I tried with both rsbuild and webpack bundlers, and for both, my remoteEntry files still include the module federation runtime.

patricklafrance avatar Dec 06 '24 03:12 patricklafrance

they will still have the federation runtime in them, it does not do anything to reduce the payload size of the remote entry itself.

ScriptedAlchemy avatar Dec 13 '24 05:12 ScriptedAlchemy