-
Notifications
You must be signed in to change notification settings - Fork 2.6k
feat(module-federation): support TS Soln and Package Manager workspaces paradigms #33056
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
base: master
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for GitHub.
|
✅ Deploy Preview for nx-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
View your CI Pipeline Execution ↗ for commit 25c1f57
☁️ Nx Cloud last updated this comment at |
fc75468
to
5273ea2
Compare
…F tests In TS solution mode with preset 'ts', projects are named with scoped package names (e.g., @proj/shell) while directories remain unscoped. Update all Nx CLI commands in the test to use the scoped package names from package.json for proper project resolution. Changes: - Use shellPkgJson.name for test, serve, and e2e commands - Use package names in build loop for all apps - Read e2e project's package.json to get its scoped name - Keep readPort() calls using directory names (file I/O, not Nx resolution) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
The test was failing with "spawnSync /bin/sh ENOENT" errors because afterEach was cleaning up the test environment after the first test, causing subsequent tests to fail when they tried to run CLI commands. Since each test uses uniq() to generate unique project names, all tests can safely run in the same workspace. The cleanup should only happen once after all tests complete. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nx Cloud is proposing a fix for your failed CI:
We've identified and fixed the test failure in the TS solution Module Federation test. The issue was that after manually adding a library as a dependency to the remote's package.json, the test didn't run pnpm install
to link the workspace dependencies. This caused TypeScript to fail when trying to resolve the library module. The fix adds the missing install step before attempting to build the remote application.
We verified this fix by re-running e2e-react:e2e-ci--src/module-federation/ts-solution-mf.test.ts
.
diff --git a/e2e/react/src/module-federation/ts-solution-mf.test.ts b/e2e/react/src/module-federation/ts-solution-mf.test.ts
index 58e51209f0..5b780fe1d5 100644
--- a/e2e/react/src/module-federation/ts-solution-mf.test.ts
+++ b/e2e/react/src/module-federation/ts-solution-mf.test.ts
@@ -255,6 +255,9 @@ describe('React Rspack Module Federation - TS Solution + PM Workspaces', () => {
)
);
+ // Run install to link the workspace dependencies
+ runCommand(getPackageManagerCommand().install);
+
// Import library in remote
const remoteAppPath = `${remote}/src/app/app.tsx`;
const remoteAppContent = readFile(remoteAppPath);
✅ The fix was applied to this branch.
🎓 To learn more about Self Healing CI, please visit nx.dev
Current Behavior
Using TS Soln Workspaces and/or Packaage Manager Workspaces, handling of certain workflows and scenarios is not correct.
Detecting and Sharing Workspace Libraries relies entirely on TS Path Aliases existing in the base TSConfig file.
All guidance also points towards adding Workspace Libraries as dependencies or devDependencies within the consuming application's package.json file.
This also does not allow correct configuration of sharing.
Meanwhile, TS Path Aliases are added for remote applications such that TS can find them in consuming applications, while also being able to provide Typing Support.
However, this has an increased build-time cost for TS compilation as it will follow the path in source.
Expected Behavior
Allow attaching Workspace Libraries as deps in the package.json of host and remote applications.
Configure packages added in such a manner correctly for share scope in Module Federation.
Attach Remote applications to Host applications via devDependencies in package.json.
Configure the
exports
andmain, types
properties in the remote application's package.json to point to thesrc/remote-entry.ts
file such that node resolution can correctly follow the paths.Bundler will continue to strip this out of compilation and replace with Module Federation Module Loading code.