fix(cli): improve path normalization of readConfig#3708
Merged
ScriptedAlchemy merged 3 commits intomainfrom Apr 18, 2025
Merged
fix(cli): improve path normalization of readConfig#3708ScriptedAlchemy merged 3 commits intomainfrom
readConfig#3708ScriptedAlchemy merged 3 commits intomainfrom
Conversation
🦋 Changeset detectedLatest commit: 958e19f The changes in this PR will be included in the next version bump. This PR includes changesets to release 32 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.
Pull Request Overview
This PR improves the path normalization in the readConfig function of the @module-federation/cli package by using file URL formatting for dynamic module imports. It also updates the changeset entry to document these improvements.
- Updated readConfig.ts to import the file URL using pathToFileURL for dynamic module imports.
- Added a changeset entry (.changeset/ai-noisy-wolf.md) summarizing the improvements.
Reviewed Changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| packages/cli/src/utils/readConfig.ts | Uses pathToFileURL to convert file paths to URLs before performing dynamic import. |
| .changeset/ai-noisy-wolf.md | Adds documentation regarding the improvements made to readConfig. |
Files not reviewed (1)
- package.json: Language not supported
Comments suppressed due to low confidence (1)
packages/cli/src/utils/readConfig.ts:19
- [nitpick] Consider adding an inline comment to clarify why there is a chained '.default' access after the import. This would improve code clarity for other developers reviewing the dynamic import behavior.
const mfConfig = (await import(pathToFileURL(preBundlePath).href)).default
2heal1
approved these changes
Apr 17, 2025
jaakko-solita
approved these changes
Apr 17, 2025
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
This pull request includes improvements to the
readConfigfunction in the@module-federation/clipackage to ensure compatibility with environments requiring file URL formats. Additionally, it updates thechangegenscript in thepackage.jsonfile to include theclipackage.Improvements to dynamic module import:
.changeset/ai-noisy-wolf.md: Added a changeset entry describing the improvements to thereadConfigfunction.packages/cli/src/utils/readConfig.ts: ImportedpathToFileURLfrom the 'url' module and updated the dynamic import statement formfConfigto usepathToFileURL(preBundlePath).href. [1] [2]Updates to
package.json:package.json: Updated thechangegenscript to include theclipackage in the list of paths.Related Issue
#3664
Types of changes
Checklist