Skip to content

Conversation

Coly010
Copy link
Contributor

@Coly010 Coly010 commented Oct 13, 2025

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 and main, types properties in the remote application's package.json to point to the src/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.

@Coly010 Coly010 requested review from a team as code owners October 13, 2025 13:16
@Coly010 Coly010 self-assigned this Oct 13, 2025
Copy link

vercel bot commented Oct 13, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Updated (UTC)
nx-dev Ready Ready Preview Oct 14, 2025 6:27pm

Copy link

netlify bot commented Oct 13, 2025

Deploy Preview for nx-docs ready!

Name Link
🔨 Latest commit 25c1f57
🔍 Latest deploy log https://app.netlify.com/projects/nx-docs/deploys/68ee91ff60ebe40008c6f485
😎 Deploy Preview https://deploy-preview-33056--nx-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 project configuration.

Copy link
Contributor

nx-cloud bot commented Oct 13, 2025

View your CI Pipeline Execution ↗ for commit 25c1f57

Command Status Duration Result
nx affected --targets=lint,test,test-kt,build,e... ✅ Succeeded 19m 54s View ↗
nx run-many -t check-imports check-commit check... ✅ Succeeded 2m 16s View ↗
nx-cloud record -- nx-cloud conformance:check ✅ Succeeded 2s View ↗
nx-cloud record -- nx format:check ✅ Succeeded 6s View ↗
nx-cloud record -- nx sync:check ✅ Succeeded 5s View ↗
nx documentation ✅ Succeeded 2m 17s View ↗

☁️ Nx Cloud last updated this comment at 2025-10-14 18:37:17 UTC

nx-cloud[bot]

This comment was marked as outdated.

@Coly010 Coly010 force-pushed the module-federation/react-pm-worksaces branch from fc75468 to 5273ea2 Compare October 13, 2025 14:29
nx-cloud[bot]

This comment was marked as outdated.

nx-cloud[bot]

This comment was marked as outdated.

nx-cloud[bot]

This comment was marked as outdated.

Coly010 and others added 2 commits October 14, 2025 11:40
…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>
nx-cloud[bot]

This comment was marked as outdated.

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>
Copy link
Contributor

@nx-cloud nx-cloud bot left a 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.

Revert fix via Nx Cloud  View interactive diff ↗


🎓 To learn more about Self Healing CI, please visit nx.dev

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.

1 participant