Conversation
🦋 Changeset detectedLatest commit: 88968e1 The changes in this PR will be included in the next version bump. This PR includes changesets to release 27 packages
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 |
✅ Deploy Preview for module-federation-docs ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Contributor
There was a problem hiding this comment.
Summary
The pull request makes the following core changes to help downgrade non-ESM projects:
- Adds a new define constant
FEDERATION_ALLOW_NEW_FUNCTIONto thepackages/runtime/src/utils/load.tsfile. - This constant is used to conditionally load the remote entry using a new
Functionconstructor instead of the standardimport()statement. - This helps bypass the
@rsbuild/plugin-check-syntaxerror when the project is not using ESM modules. - The changes are accompanied by updates to the documentation and tests.
File Summaries
| File | Summary |
|---|---|
| packages/runtime/src/utils/load.ts | The code changes introduce a new define constant FEDERATION_ALLOW_NEW_FUNCTION to help downgrade non-ESM projects. This constant is used to conditionally load the remote entry using a new Function constructor instead of the standard import() statement, which can help bypass the @rsbuild/plugin-check-syntax error when the project is not using ESM modules. |
Contributor
There was a problem hiding this comment.
Incremental Review
Comments posted: 3
Configuration
Squadron Mode: essential
Commits Reviewed
13e94cd132c27589a23396925f7fdc6167d809ee...2cbc1bd52020e77d676c014c8d7d29bc757bd87c
Files Reviewed
- packages/runtime/src/utils/load.ts
Files Ignored
These files were ignored due to the filter in the squadron.yaml file.
- .changeset/dirty-bikes-report.md
- packages/runtime/global.d.ts
ScriptedAlchemy
approved these changes
Nov 21, 2024
ScriptedAlchemy
approved these changes
Nov 21, 2024
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
The magic comment(webpackIgnore) will make rspack not downgrade the code , and @rsbuild/plugin-check-syntax will throw error . If users can make sure the project not use esm type module, they can set
FEDERATION_ALLOW_NEW_FUNCTIONby define plugin in build config , and skip the checker.Related Issue
reproduce repo: https://github.com/2heal1/rsbuild-demo/tree/chore/syntax-check
Types of changes
Checklist