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

chore: split runtime as core and entry #3154

Merged
merged 35 commits into from
Dec 31, 2024
Merged

Conversation

2heal1
Copy link
Member

@2heal1 2heal1 commented Nov 1, 2024

Description

  1. split runtime into two parts : runtime-core entry
  • runtime-core: no sideEffect
  • entry: has sideEffect , it will cache federationInstance
  1. add externalRuntime and provideExternalRuntime field to help optimize assets size

About next major version

Plans to make @module-federation/runtime-core to become @module-federation/runtime , because currently the runtime package has sideEffects which can no be extends easily , like external it by cdn etc.

So , it's necessary to change it . We can only export init to users , users should store the instance by theirselves .

This will make a break change ,so it's just a plan , we can do it on 1.0.0 version . cc @ScriptedAlchemy @zhoushaw

Related Issue

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.

Copy link

netlify bot commented Nov 1, 2024

Deploy Preview for module-federation-docs ready!

Name Link
🔨 Latest commit d44098e
🔍 Latest deploy log https://app.netlify.com/sites/module-federation-docs/deploys/67739fe8afe8d50008b29d1d
😎 Deploy Preview https://deploy-preview-3154--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.

Copy link
Contributor

@squadronai squadronai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary

The core changes in this pull request focus on splitting the Module Federation runtime into two parts: runtime-core and entry. The key objectives are:

  • The runtime-core package will have no side effects, while the entry package will handle caching the federation instance and have side effects.
  • The changes introduce externalRuntime and provideExternalRuntime fields to help optimize asset size by enabling the use of an external runtime, either by providing it or by caching the federation instance.
  • This is part of a plan to make @module-federation/runtime-core the main @module-federation/runtime package, where only the init function will be exported, and users will be responsible for storing the instance themselves. This will allow for easier extensibility, such as using a CDN.
  • The changes are designed to improve the overall flexibility and extensibility of the Module Federation runtime, with the goal of making it easier to integrate into existing codebases and optimize asset sizes.
File Summaries
File Summary
packages/enhanced/src/lib/container/ModuleFederationPlugin.ts The code changes introduce a split of the runtime into two parts: runtime-core and entry. The runtime-core has no side effects, while the entry part has side effects and will cache the federationInstance. Additionally, the changes add externalRuntime and provideExternalRuntime fields to help optimize asset size. This is part of a plan to make @module-federation/runtime-core become @module-federation/runtime in the next major version, which will involve a breaking change to only export the init function and require users to store the instance themselves.
packages/enhanced/src/schemas/container/ContainerPlugin.check.ts The changes in this file split the runtime into two parts: runtime-core and entry. The runtime-core has no side effects, while the entry part has side effects and will cache the federationInstance. Additionally, the changes introduce externalRuntime and provideExternalRuntime fields to help optimize asset size. This is part of a plan to make @module-federation/runtime-core the main @module-federation/runtime package, as the current runtime package has side effects that make it difficult to extend, such as using a CDN.
packages/enhanced/src/schemas/container/ContainerPlugin.ts The code changes introduce two new configuration options, "externalRuntime" and "provideExternalRuntime", to the "federationRuntime" schema. These options allow for optimizing asset size by enabling the use of an external runtime, either by providing it or by caching the federation instance.
packages/rspack/src/ModuleFederationPlugin.ts The code changes introduce two new features related to the Module Federation runtime: the ability to provide an external runtime and the ability to mark the runtime as external. These changes are likely part of an effort to optimize the asset size of the Module Federation runtime by allowing it to be loaded from a CDN or other external source.
packages/runtime-core/src/constant.ts The code changes introduce a split of the runtime module into two parts: runtime-core and entry. The runtime-core module has no side effects, while the entry module has side effects and will cache the federation instance. Additionally, the changes introduce externalRuntime and provideExternalRuntime fields to help optimize asset size. This is part of a plan to make @module-federation/runtime-core the main @module-federation/runtime package, as the current runtime package has side effects that make it difficult to extend, such as using a CDN.
packages/runtime-core/src/core.ts The code changes introduce a split of the runtime into two parts: runtime-core and entry. The runtime-core has no side effects, while the entry part has side effects and will cache the federationInstance. Additionally, the changes add externalRuntime and provideExternalRuntime fields to help optimize asset size. This is part of a plan to make @module-federation/runtime-core become @module-federation/runtime in the next major version, as the current runtime package has side effects that can make it difficult to extend, such as external it by CDN.
packages/runtime-core/src/global.ts The code changes introduce a split of the runtime into two parts: runtime-core and entry. The runtime-core has no side effects, while the entry part has side effects and will cache the federationInstance. Additionally, the changes add externalRuntime and provideExternalRuntime fields to help optimize asset size. This is part of a plan to make @module-federation/runtime-core become @module-federation/runtime in the next major version, as the current runtime package has side effects that can be difficult to extend, such as external it by CDN.
packages/runtime-core/src/helpers.ts The code changes introduce a new file helpers.ts that exports two utility modules: GlobalUtils and ShareUtils. The GlobalUtils module provides a collection of functions and properties related to managing the global state and behavior of the Module Federation runtime. The ShareUtils module provides functions for managing the global share scope. These changes appear to be part of a larger effort to split the Module Federation runtime into a core and an entry module, with the goal of optimizing asset size and making the runtime more extensible.
packages/runtime-core/src/index.ts The code changes introduce a split of the runtime into two parts: runtime-core and entry. The runtime-core package has no side effects, while the entry package has side effects and will cache the federationInstance. Additionally, the changes introduce externalRuntime and provideExternalRuntime fields to help optimize asset size. This is part of a plan to make @module-federation/runtime-core become @module-federation/runtime in the next major version, where the runtime package will only export the init function, and users will be responsible for storing the instance themselves, allowing for easier extensibility like external CDN usage.
packages/runtime-core/src/module/index.ts The changes in this pull request involve splitting the runtime module into two parts: runtime-core and entry. The runtime-core module is designed to have no side effects, while the entry module will handle caching the federation instance. Additionally, the changes introduce externalRuntime and provideExternalRuntime fields to help optimize asset size. This is part of a plan to make @module-federation/runtime-core the main @module-federation/runtime package, which will export only the init function, allowing users to manage the instance themselves.
packages/runtime-core/src/plugins/generate-preload-assets.ts The code changes introduce a new feature to split the runtime into two parts: runtime-core and entry. The runtime-core has no side effects, while the entry part has side effects and will cache the federationInstance. Additionally, the changes add externalRuntime and provideExternalRuntime fields to help optimize asset sizes. This is part of a plan to make @module-federation/runtime-core the main @module-federation/runtime package, which will export only the init function, allowing users to manage the instance themselves, a breaking change planned for the 1.0.0 version.
packages/runtime-core/src/plugins/snapshot/SnapshotHandler.ts The changes in this file introduce a new feature to split the runtime into two parts: runtime-core and entry. The runtime-core part has no side effects, while the entry part has side effects and will cache the federation instance. Additionally, the changes add externalRuntime and provideExternalRuntime fields to help optimize asset size. This is part of a plan to make @module-federation/runtime-core the main @module-federation/runtime package, which will export only the init function, allowing users to store the instance themselves, making it easier to extend the runtime, such as by using a CDN.
packages/runtime-core/src/plugins/snapshot/index.ts The changes in this file split the runtime into two parts: runtime-core and entry. The runtime-core has no side effects, while the entry part has side effects and will cache the federationInstance. Additionally, the changes introduce externalRuntime and provideExternalRuntime fields to help optimize asset size. This is part of a plan to make @module-federation/runtime-core the main @module-federation/runtime package, as the current runtime package has side effects that make it difficult to extend, such as using a CDN.
packages/runtime-core/src/remote/index.ts The changes in this pull request involve splitting the runtime module into two parts: runtime-core and entry. The runtime-core module has no side effects, while the entry module has side effects and will cache the federation instance. Additionally, the changes introduce externalRuntime and provideExternalRuntime fields to help optimize asset size. This is part of a plan to make @module-federation/runtime-core the main @module-federation/runtime package, as the current runtime package has side effects that make it difficult to extend, such as using a CDN.
packages/runtime-core/src/shared/index.ts The changes in this pull request involve splitting the runtime package into two parts: runtime-core and entry. The runtime-core package will have no side effects, while the entry package will handle caching the federation instance. Additionally, the changes introduce externalRuntime and provideExternalRuntime fields to help optimize asset size. This is part of a plan to make @module-federation/runtime-core the main @module-federation/runtime package, which will export only the init function, allowing users to manage the instance themselves.
packages/runtime-core/src/type/config.ts The changes in this file involve splitting the runtime into two parts: runtime-core and entry. The runtime-core part has no side effects, while the entry part has side effects and will cache the federationInstance. Additionally, the changes introduce externalRuntime and provideExternalRuntime fields to help optimize asset size. This is part of a plan to make @module-federation/runtime-core the main @module-federation/runtime package, where the runtime package will only export the init function, and users will be responsible for storing the instance themselves, which will result in a breaking change in the next major version.
packages/runtime-core/src/type/index.ts The changes in this pull request involve splitting the runtime module into two parts: runtime-core and entry. The runtime-core module is designed to have no side effects, while the entry module will handle caching the federation instance. Additionally, the changes introduce externalRuntime and provideExternalRuntime fields to help optimize asset size. This is part of a plan to make @module-federation/runtime-core the main @module-federation/runtime package, which will export only the init function, allowing users to manage the instance themselves.
packages/runtime-core/src/type/plugin.ts The changes in this pull request involve splitting the runtime module into two parts: runtime-core and entry. The runtime-core module has no side effects, while the entry module has side effects and will cache the federation instance. Additionally, the changes introduce externalRuntime and provideExternalRuntime fields to help optimize asset size. This is part of a plan to make @module-federation/runtime-core the main @module-federation/runtime package, where the runtime package will only export the init function, and users will be responsible for storing the instance themselves, which will introduce a breaking change in the next major version.
packages/runtime-core/src/type/preload.ts The changes in this pull request involve splitting the runtime module into two parts: runtime-core and entry. The runtime-core module is designed to have no side effects, while the entry module will handle caching the federation instance. Additionally, the changes introduce externalRuntime and provideExternalRuntime fields to help optimize asset size. This is part of a plan to make @module-federation/runtime-core the main @module-federation/runtime package, which will export only the init function, allowing users to manage the instance themselves.
packages/runtime-core/src/types.ts The code changes introduce a new file types.ts in the packages/runtime-core directory, which exports all types from the type.ts file. This change likely aims to simplify the API and make it easier for users to access the necessary types from a single entry point.
packages/runtime-core/src/utils/env.ts The changes in this file involve splitting the runtime into two parts: runtime-core and entry. The runtime-core package will have no side effects, while the entry package will have side effects and cache the federation instance. Additionally, the changes introduce externalRuntime and provideExternalRuntime fields to help optimize asset size. This is part of a plan to make @module-federation/runtime-core the main @module-federation/runtime package, where the runtime package will only export the init function, and users will be responsible for storing the instance themselves.
packages/runtime-core/src/utils/hooks/asyncHook.ts The changes in this file split the runtime into two parts: runtime-core and entry. The runtime-core has no side effects, while the entry part has side effects and will cache the federationInstance. Additionally, the changes introduce externalRuntime and provideExternalRuntime fields to help optimize asset size. This is part of a plan to make @module-federation/runtime-core the main @module-federation/runtime package, as the current runtime package has side effects that make it difficult to extend, such as using a CDN.
packages/runtime-core/src/utils/hooks/asyncWaterfallHooks.ts The changes in this file split the runtime into two parts: runtime-core and entry. The runtime-core has no side effects, while the entry part has side effects and will cache the federationInstance. Additionally, the changes introduce externalRuntime and provideExternalRuntime fields to help optimize asset size. This is part of a plan to make @module-federation/runtime-core the main @module-federation/runtime package, as the current runtime package has side effects that make it difficult to extend, such as using a CDN.
packages/runtime-core/src/utils/hooks/index.ts The code changes introduce a new feature to split the runtime into two parts: runtime-core and entry. The runtime-core package will have no side effects, while the entry package will have side effects and cache the federation instance. Additionally, the changes introduce externalRuntime and provideExternalRuntime fields to help optimize asset size. This is part of a plan to make @module-federation/runtime-core the main @module-federation/runtime package, where only the init function will be exported, and users will be responsible for storing the instance themselves, which will allow for easier extensibility, such as using a CDN.
packages/runtime-core/src/utils/hooks/pluginSystem.ts The changes in this file introduce a split of the runtime module into two parts: runtime-core and entry. The runtime-core module is designed to have no side effects, while the entry module will handle caching the federation instance. Additionally, the changes introduce externalRuntime and provideExternalRuntime fields to help optimize asset size. These changes are part of a larger plan to make the runtime package more extensible and easier to use, which may result in a breaking change in the future.
packages/runtime-core/src/utils/hooks/syncHook.ts The changes in this file split the runtime into two parts: runtime-core and entry. The runtime-core part has no side effects, while the entry part has side effects and will cache the federationInstance. Additionally, the changes introduce externalRuntime and provideExternalRuntime fields to help optimize asset size. This is part of a plan to make @module-federation/runtime-core become @module-federation/runtime in the next major version, which will involve a breaking change to only export the init function and require users to store the instance themselves.
packages/runtime-core/src/utils/hooks/syncWaterfallHook.ts The changes in this file introduce a new feature to split the runtime into two parts: runtime-core and entry. The runtime-core part has no side effects, while the entry part has side effects and will cache the federation instance. Additionally, the changes add externalRuntime and provideExternalRuntime fields to help optimize asset size. These changes are part of a plan to make @module-federation/runtime-core the main @module-federation/runtime package, which will involve a breaking change in the next major version.
packages/runtime-core/src/utils/index.ts The changes in this file split the runtime into two parts: runtime-core and entry. The runtime-core package has no side effects, while the entry package has side effects and will cache the federation instance. Additionally, the changes introduce externalRuntime and provideExternalRuntime fields to help optimize asset size.
packages/runtime-core/src/utils/load.ts The changes in this file introduce a split of the runtime into two parts: runtime-core and entry. The runtime-core has no side effects, while the entry part has side effects and will cache the federation instance. Additionally, the changes add externalRuntime and provideExternalRuntime fields to help optimize asset size. This is part of a plan to make @module-federation/runtime-core the main @module-federation/runtime package, as the current runtime package has side effects that make it difficult to extend, such as using it with a CDN.
packages/runtime-core/src/utils/logger.ts The changes in this pull request involve splitting the runtime module into two parts: runtime-core and entry. The runtime-core module will have no side effects, while the entry module will handle caching the federation instance. Additionally, the changes introduce externalRuntime and provideExternalRuntime fields to help optimize asset size. This is part of a plan to make @module-federation/runtime-core the primary runtime package, with the goal of making it more extensible and allowing users to manage the instance themselves.
packages/runtime-core/src/utils/manifest.ts The changes in this file involve splitting the runtime into two parts: runtime-core and entry. The runtime-core part has no side effects, while the entry part has side effects and will cache the federationInstance. Additionally, the changes introduce externalRuntime and provideExternalRuntime fields to help optimize asset size. These changes are part of a plan to make @module-federation/runtime-core the main @module-federation/runtime package, where the runtime package will only export the init function, and users will be responsible for storing the instance themselves.
packages/runtime-core/src/utils/plugin.ts The changes in this file split the runtime into two parts: runtime-core and entry. The runtime-core has no side effects, while the entry part has side effects and will cache the federationInstance. Additionally, the changes introduce externalRuntime and provideExternalRuntime fields to help optimize asset size. This is part of a plan to make @module-federation/runtime-core the main @module-federation/runtime package, as the current runtime package has side effects that make it difficult to extend, such as using a CDN.
packages/runtime-core/src/utils/preload.ts The code changes introduce a split of the runtime module into two parts: runtime-core and entry. The runtime-core module has no side effects, while the entry module has side effects and caches the federation instance. Additionally, the changes introduce externalRuntime and provideExternalRuntime fields to help optimize asset size. This is part of a plan to make @module-federation/runtime-core the main @module-federation/runtime package, where the runtime package will only export the init function, and users will be responsible for storing the instance themselves, which will enable easier extensibility, such as external CDN usage.
packages/runtime-core/src/utils/semver/compare.ts The changes in this file split the runtime into two parts: runtime-core and entry. The runtime-core package has no side effects, while the entry package has side effects and will cache the federation instance. Additionally, the changes introduce externalRuntime and provideExternalRuntime fields to help optimize asset size. This is part of a plan to make @module-federation/runtime-core the main @module-federation/runtime package, as the current runtime package has side effects that make it difficult to extend, such as using a CDN.
packages/runtime-core/src/utils/semver/constants.ts The changes in this file involve splitting the runtime into two parts: runtime-core and entry. The runtime-core part has no side effects, while the entry part has side effects and will cache the federationInstance. Additionally, the changes introduce externalRuntime and provideExternalRuntime fields to help optimize asset size. This is part of a plan to make @module-federation/runtime-core the main @module-federation/runtime package, as the current runtime package has side effects that make it difficult to extend, such as using a CDN.
packages/runtime-core/src/utils/semver/index.ts The changes in this pull request involve splitting the runtime into two parts: runtime-core and entry. The runtime-core package will have no side effects, while the entry package will have side effects and cache the federation instance. Additionally, the changes introduce externalRuntime and provideExternalRuntime fields to help optimize asset size. This is part of a plan to make @module-federation/runtime-core the main @module-federation/runtime package, as the current runtime package has side effects that make it difficult to extend, such as using a CDN.
packages/runtime-core/src/utils/semver/parser.ts The changes in this pull request involve splitting the runtime into two parts: runtime-core and entry. The runtime-core package will have no side effects, while the entry package will have side effects and cache the federation instance. Additionally, the changes introduce externalRuntime and provideExternalRuntime fields to help optimize asset size. This is part of a plan to make @module-federation/runtime-core the main @module-federation/runtime package, which will export only the init function, allowing users to manage the instance themselves, a change that will be introduced in the next major version.
packages/runtime-core/src/utils/semver/utils.ts The changes in this file involve splitting the runtime module into two parts: runtime-core and entry. The runtime-core module will have no side effects, while the entry module will handle caching the federation instance. Additionally, the changes introduce externalRuntime and provideExternalRuntime fields to help optimize asset size. This is part of a plan to make @module-federation/runtime-core the main @module-federation/runtime package, which will export only the init function, allowing users to manage the instance themselves.
packages/runtime-core/src/utils/share.ts The changes in this file split the runtime into two parts: runtime-core and entry. The runtime-core part has no side effects, while the entry part has side effects and will cache the federation instance. Additionally, the changes introduce externalRuntime and provideExternalRuntime fields to help optimize asset size. This is part of a plan to make @module-federation/runtime-core the main @module-federation/runtime package, which will involve a breaking change in the next major version.
packages/runtime-core/src/utils/tool.ts The changes in this file involve splitting the runtime into two parts: runtime-core and entry. The runtime-core part has no side effects, while the entry part has side effects and will cache the federation instance. Additionally, the changes introduce externalRuntime and provideExternalRuntime fields to help optimize asset size. This is part of a plan to make @module-federation/runtime-core the main @module-federation/runtime package, as the current runtime package has side effects that make it difficult to extend, such as using a CDN.
packages/runtime-plugins/inject-external-runtime-core-plugin/src/index.ts This code change introduces a new plugin called "inject-external-runtime-core-plugin" that injects the runtime-core module into the global scope. The plugin checks if there is an existing runtime-core instance and warns the user if there are multiple instances, ensuring that there is only one consumer of the runtime-core. This change is likely part of a larger effort to split the runtime into a core and an entry module, with the goal of optimizing asset size and making the runtime more extensible.
packages/runtime-tools/src/runtime-core.ts The changes in this file involve splitting the runtime into two parts: runtime-core and entry. The runtime-core package will have no side effects, while the entry package will have side effects and cache the federation instance. Additionally, the changes introduce externalRuntime and provideExternalRuntime fields to help optimize asset size. This is part of a plan to make @module-federation/runtime-core the main @module-federation/runtime package, where only the init function will be exported, and users will be responsible for storing the instance themselves.
packages/runtime/src/core.ts The code changes split the runtime into two parts: runtime-core and entry. The runtime-core has no side effects, while the entry has side effects and will cache the federationInstance. Additionally, the changes introduce externalRuntime and provideExternalRuntime fields to help optimize asset size. This is part of a plan to make @module-federation/runtime-core become @module-federation/runtime in the next major version, as the current runtime package has side effects that can make it difficult to extend, like using an external CDN.
packages/runtime/src/helpers.ts This code change splits the runtime into two parts: runtime-core and entry. The runtime-core part has no side effects, while the entry part has side effects and will cache the federationInstance. Additionally, the changes introduce externalRuntime and provideExternalRuntime fields to help optimize asset size. The goal is to make @module-federation/runtime-core the main runtime package, with the ability to easily extend it, like using a CDN, which will be a breaking change in the next major version.
packages/runtime/src/index.ts This code change splits the runtime into two parts: runtime-core and entry. The runtime-core has no side effects, while the entry part has side effects and will cache the federationInstance. Additionally, the changes introduce externalRuntime and provideExternalRuntime fields to help optimize asset size. The goal is to make @module-federation/runtime-core the main runtime package, as the current runtime package has side effects that make it difficult to extend, such as using a CDN. This change is planned for the next major version release.
packages/runtime/src/types.ts The code changes split the runtime package into two parts: runtime-core and entry. The runtime-core package has no side effects, while the entry package has side effects and will cache the federation instance. Additionally, the changes introduce externalRuntime and provideExternalRuntime fields to help optimize asset size. This is a preparatory step for the upcoming major version, where the plan is to make @module-federation/runtime-core the main @module-federation/runtime package, exporting only the init function and requiring users to store the instance themselves.
packages/runtime/src/utils.ts The code changes introduce a new utility function getGlobalFederationInstance that retrieves a specific Federation Host instance from the global __FEDERATION__ object. This function allows identifying the instance based on the module's name and optional version, or by the build identifier. This change aims to optimize the handling of Federation instances, particularly in scenarios where multiple instances may exist.
packages/sdk/src/types/plugins/ModuleFederationPlugin.ts The code changes introduce two new fields, externalRuntime and provideExternalRuntime, to the ModuleFederationPluginOptions interface. These changes are part of a larger effort to split the runtime into two parts: runtime-core and entry. The goal is to optimize asset size by allowing the use of an external runtime, which can be cached and shared across applications.

it('verify resources when URL specifies protocol (http)', () => {
const url = 'http://a.b.c';
const scriptElement = document.createElement('script');
scriptElement.src = url;

Check warning

Code scanning / CodeQL

Inclusion of functionality from an untrusted source Medium test

Script loaded using unencrypted connection.
Copy link

changeset-bot bot commented Nov 9, 2024

🦋 Changeset detected

Latest commit: d44098e

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

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

@ScriptedAlchemy ScriptedAlchemy force-pushed the chore/external-runtime-core branch from 67a6235 to d56d6fa Compare November 9, 2024 02:38
@ScriptedAlchemy ScriptedAlchemy changed the title WIP: chore: split runtime as core and entry chore: split runtime as core and entry Nov 22, 2024
@ScriptedAlchemy ScriptedAlchemy mentioned this pull request Dec 3, 2024
5 tasks
@ScriptedAlchemy ScriptedAlchemy force-pushed the chore/external-runtime-core branch from f7479be to 8e13a48 Compare December 3, 2024 23:36
@2heal1
Copy link
Member Author

2heal1 commented Dec 20, 2024

processing this pr now

@2heal1
Copy link
Member Author

2heal1 commented Dec 20, 2024

@ScriptedAlchemy hey , i add externalRuntime field to help users access this feature easier ,WDYT ?

@ScriptedAlchemy
Copy link
Member

@2heal1 i like it! I can review more tomorrow.
Is this ready to merge?

@2heal1
Copy link
Member Author

2heal1 commented Dec 20, 2024

@2heal1 i like it! I can review more tomorrow. Is this ready to merge?

It needs to be tested in byte repo , but not longer , next Monday can be ready .

@2heal1
Copy link
Member Author

2heal1 commented Dec 20, 2024

Also i add some info for version 1.0.0 .

Plans to make @module-federation/runtime-core to become @module-federation/runtime , because currently the runtime package has sideEffects which can no be extends easily , like external it by cdn etc.

So , it's necessary to change it . We can only export init to users , users should store the instance by theirselves .

This will make a break change ,so it's just a plan , we can do it on 1.0.0 version . WDYT @ScriptedAlchemy @zhoushaw

@2heal1 2heal1 changed the title chore: split runtime as core and entry WIP: chore: split runtime as core and entry Dec 30, 2024
@2heal1
Copy link
Member Author

2heal1 commented Dec 30, 2024

wait for reviewing

@@ -75,6 +75,28 @@ export class ModuleFederationPlugin implements RspackPluginInstance {
this._patchChunkSplit(compiler, options.name);
}

if (options.experiments?.provideExternalRuntime) {
if (options.exposes) {
throw new Error(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why can we only do this to pure consumers?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think in the future we should be able to support both.
in my previous PR i had setup something that allowed the remote of a build to use a different federation entry file which used the external referenced package. So i think its possible to do the same here but i will adjust my PR

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to avoid duplicate inject runtime , if it has exposes , it's usually will be consumed

@2heal1 2heal1 merged commit f573ad0 into main Dec 31, 2024
15 of 16 checks passed
@2heal1 2heal1 deleted the chore/external-runtime-core branch December 31, 2024 07:46
@2heal1 2heal1 changed the title WIP: chore: split runtime as core and entry chore: split runtime as core and entry Dec 31, 2024
@2heal1 2heal1 mentioned this pull request Dec 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants