Skip to content

chore(core): build nx to local dist and use nodenext#34111

Draft
Coly010 wants to merge 64 commits intomasterfrom
chore/nx-local-dist
Draft

chore(core): build nx to local dist and use nodenext#34111
Coly010 wants to merge 64 commits intomasterfrom
chore/nx-local-dist

Conversation

@Coly010
Copy link
Contributor

@Coly010 Coly010 commented Jan 15, 2026

Nx package builds to local dist folder
Nx uses nodenext for module + moduleResolution
Nx uses @swc/jest for unit testing to handle nodenext

Closes NXC-3570

@Coly010 Coly010 self-assigned this Jan 15, 2026
@vercel
Copy link

vercel bot commented Jan 15, 2026

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

Project Deployment Review Updated (UTC)
nx-dev Ready Ready Preview Jan 23, 2026 5:18pm

Request Review

@netlify
Copy link

netlify bot commented Jan 15, 2026

Deploy Preview for nx-docs failed. Why did it fail? →

Name Link
🔨 Latest commit a1b8225
🔍 Latest deploy log https://app.netlify.com/projects/nx-docs/deploys/69b811c70122290008614c1e

@nx-cloud
Copy link
Contributor

nx-cloud bot commented Jan 15, 2026

View your CI Pipeline Execution ↗ for commit a1b8225

Command Status Duration Result
nx affected --targets=lint,test,build,e2e,e2e-c... ✅ Succeeded 44m 29s View ↗
nx run-many -t check-imports check-lock-files c... ✅ Succeeded 4m 44s View ↗
nx-cloud record -- nx format:check ✅ Succeeded 20s View ↗
nx-cloud record -- nx sync:check ✅ Succeeded <1s View ↗
nx affected -t e2e-macos-local --parallel=1 --b... ✅ Succeeded 30m 4s View ↗

☁️ Nx Cloud last updated this comment at 2026-03-16 15:10:15 UTC

nx-cloud[bot]

This comment was marked as outdated.

nx-cloud[bot]

This comment was marked as outdated.

@Coly010 Coly010 force-pushed the chore/nx-local-dist branch from e88f09d to 355cb3c Compare January 15, 2026 16:38
@Coly010 Coly010 changed the title chore(core): build nx to local dist and use nodenext" chore(core): build nx to local dist and use nodenext Jan 15, 2026
@Coly010 Coly010 force-pushed the chore/nx-local-dist branch from 0e73eba to 3038774 Compare January 15, 2026 17:55
@Coly010 Coly010 force-pushed the chore/nx-local-dist branch from 3038774 to bce8591 Compare January 15, 2026 18:03
nx-cloud[bot]

This comment was marked as outdated.

@Coly010 Coly010 force-pushed the chore/nx-local-dist branch from bce8591 to 4b4f86a Compare January 21, 2026 13:53
nx-cloud[bot]

This comment was marked as outdated.

nx-cloud[bot]

This comment was marked as outdated.

Coly010 and others added 28 commits March 16, 2026 10:08
Fixes missed path updates in e2e tests for the nx package dist restructuring.
The exports field was missing entries for migrations.json, generators.json,
and executors.json. This caused ERR_PACKAGE_PATH_NOT_EXPORTED when resolving
bare specifiers like 'nx/migrations.json' (used by nx repair/lerna repair).
…V test

The "should be resilient against NODE_ENV values" test was using
...process.env which leaked unfiltered NX_* variables into the child
process, causing Nx Cloud initialization failures. Use
getStrippedEnvironmentVariables() instead, which is already imported
and properly filters out problematic variables while preserving PATH.
The exports field in nx package.json enables Node.js self-referencing,
causing require.resolve with paths option to always resolve to the
current package. This made isLocalInstall always true, breaking
global-to-local nx delegation.

Use Module.createRequire from an external context to resolve nx, which
avoids triggering self-referencing while still following the exports map.
The previous commit switched to `require()` for reading nx/package.json
which causes Node's require cache to return stale data when the file is
modified on disk. Use `readJsonFile` instead to always read fresh from
disk while keeping the `createRequire`+`resolve` approach for path
resolution.

Fixes e2e-nx misc.test.ts failures for version mismatch warnings.
…cutor

The `import * as process from 'node:process'` was compiled by tslib's
__importStar into a wrapper object that only copies own properties.
Since `process.on` is inherited from EventEmitter.prototype, it was
undefined on the wrapper, causing `TypeError: process.on is not a
function` in the module-federation-static-server executor.

The global `process` is always available in Node.js — no import needed.
…lass directly

The tests were mutating require('eslint').loadESLint, but resolveESLintClass
uses await import('eslint') which returns a different module namespace in Jest.
Spy on resolveESLintClass instead to correctly control the returned ESLint class.
Add module-level jest.mock for fs to ensure existsSync and readFileSync
are properly intercepted by SWC-compiled imports. Without this, the
destructured imports bind directly and bypass jest.spyOn calls in
beforeEach.
Co-authored-by: Coly010 <Coly010@users.noreply.github.com>
Co-authored-by: Coly010 <Coly010@users.noreply.github.com>
…post-build deps

nx:copy-local-native only provides native binaries at packages/nx/dist/src/native/
but legacy-post-build also needs the compiled JS at packages/nx/dist/. Using
nx:build-base provides both since it transitively depends on copy-local-native.

Also restores ^build-base for dotnet and maven overrides which was previously dropped.
Replace jest.spyOn(enquirer, 'prompt') with module-level jest.mock
pattern to fix CJS module mocking issues in CI.
…ig for pnpm compatibility

The react-native jest preset's transformIgnorePatterns doesn't account for
pnpm's .pnpm/ node_modules structure, causing Flow type parsing errors in
@react-native/js-polyfills. The generated jest config now includes a
pnpm-compatible pattern that works with all package managers.
Co-authored-by: Coly010 <Coly010@users.noreply.github.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.

Important

At least one additional CI pipeline execution has run since the conclusion below was written and it may no longer be applicable.

Nx Cloud has identified a possible root cause for your failed CI:

We investigated the maven-batch-runner:_package failure and found it is caused by a corrupted or incompletely initialized Nx workspace database (.nx/workspace-data), not by any code introduced in this PR. Running nx reset on the CI environment should resolve the issue and allow the task to pass on a rerun.

No code changes were suggested for this issue.

Trigger a rerun:

Rerun CI

Nx Cloud View detailed reasoning on Nx Cloud ↗

🔔 Heads up, your workspace has pending recommendations ↗ to auto-apply fixes for similar failures.


🎓 Learn more about Self-Healing CI on nx.dev

…esbuild import

The react-native vite config template imported esbuild directly, which fails
during project graph processing in pnpm strict mode because esbuild is only
a transitive dependency of vite and not hoisted to root node_modules.

Fixes e2e-detox:e2e-macos-local failure.
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.

2 participants