Skip to content

fix(cli): improve path normalization of readConfig #3708

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

Merged
merged 3 commits into from
Apr 18, 2025

Conversation

ScriptedAlchemy
Copy link
Member

Description

This pull request includes improvements to the readConfig function in the @module-federation/cli package to ensure compatibility with environments requiring file URL formats. Additionally, it updates the changegen script in the package.json file to include the cli package.

Improvements to dynamic module import:

Updates to package.json:

  • package.json: Updated the changegen script to include the cli package in the list of paths.

Related Issue

#3664

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

changeset-bot bot commented Apr 16, 2025

🦋 Changeset detected

Latest commit: 958e19f

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

This PR includes changesets to release 32 packages
Name Type
@module-federation/cli Patch
@module-federation/enhanced Patch
@module-federation/modern-js Patch
@module-federation/nextjs-mf Patch
@module-federation/node Patch
@module-federation/rsbuild-plugin Patch
@module-federation/storybook-addon Patch
@module-federation/modernjsapp Patch
remote5 Patch
@module-federation/runtime Patch
@module-federation/rspack Patch
@module-federation/webpack-bundler-runtime Patch
@module-federation/sdk Patch
@module-federation/runtime-tools Patch
@module-federation/managers Patch
@module-federation/manifest Patch
@module-federation/dts-plugin Patch
@module-federation/third-party-dts-extractor Patch
@module-federation/devtools Patch
@module-federation/bridge-react Patch
@module-federation/bridge-vue3 Patch
@module-federation/bridge-shared Patch
@module-federation/bridge-react-webpack-plugin Patch
@module-federation/retry-plugin Patch
@module-federation/data-prefetch Patch
@module-federation/error-codes Patch
@module-federation/inject-external-runtime-core-plugin Patch
@module-federation/runtime-core Patch
create-module-federation Patch
@module-federation/esbuild Patch
@module-federation/utilities Patch
website-new 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

Copy link

netlify bot commented Apr 16, 2025

Deploy Preview for module-federation-docs ready!

Name Link
🔨 Latest commit 958e19f
🔍 Latest deploy log https://app.netlify.com/sites/module-federation-docs/deploys/6801bdf41f7fb00008b0acaf
😎 Deploy Preview https://deploy-preview-3708--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

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

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

@ScriptedAlchemy ScriptedAlchemy marked this pull request as ready for review April 17, 2025 02:55
@ScriptedAlchemy ScriptedAlchemy merged commit e9a0681 into main Apr 18, 2025
5 of 7 checks passed
@ScriptedAlchemy ScriptedAlchemy deleted the fix-windows-cli-path branch April 18, 2025 02:50
@2heal1 2heal1 mentioned this pull request Apr 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants