Skip to content

fix(js): build to local dist and use nodenext#35538

Draft
FrozenPandaz wants to merge 2 commits intomasterfrom
test-dist-skill
Draft

fix(js): build to local dist and use nodenext#35538
FrozenPandaz wants to merge 2 commits intomasterfrom
test-dist-skill

Conversation

@FrozenPandaz
Copy link
Copy Markdown
Contributor

Current Behavior

@nx/js builds to the shared workspace-root dist/packages/js/ directory, uses CommonJS module/moduleResolution, has no exports map, and relies on .npmignore-style filtering through assets.json copies. This makes the package layout diverge from the new pattern already adopted by nx and @nx/devkit.

Expected Behavior

@nx/js follows the same local-dist build pattern as nx and @nx/devkit:

  • Builds to packages/js/dist/ instead of dist/packages/js/.
  • tsconfig.lib.json uses module/moduleResolution: "nodenext" with composite, rootDir: ".", and declarationDir: "dist".
  • package.json declares an exports map with the @nx/nx-source condition (workspace consumers resolve to .ts source, published consumers get built .js), plus a ./src/* wildcard so the ~296 existing internal imports of @nx/js/src/... keep working.
  • typesVersions added for legacy moduleResolution: "node" consumers.
  • Adopts an explicit files field on package.json instead of asset-copying the root JSONs.
  • generators.json, executors.json, migrations.json factory/schema paths rewritten ./src/..../dist/src/... (matches nx). Workspace dev still works via the tryResolveFromSource fallback in packages/nx/src/config/schema-utils.ts.
  • README.mdreadme-template.md; build command writes the rendered README to packages/js/README.md. Root .gitignore now ignores packages/js/README.md and packages/js/**/*.d.ts (with !packages/js/src/**/schema.d.ts exception for committed schema declarations).
  • ESLint flat config ignores dist and **/*.d.ts.
  • project.json adds release.version config and nx-release-publish.packageRoot. The build target keeps its existing dependsOn: ["build-base"] (cannot use ^build because js's implicitDependencies create a cycle through eslint / eslint-plugin).

Related Issue(s)

Part of the ongoing migration of Nx packages to the local-dist build layout (following nx and @nx/devkit).

@netlify
Copy link
Copy Markdown

netlify Bot commented May 1, 2026

Deploy Preview for nx-docs ready!

Name Link
🔨 Latest commit 27b3380
🔍 Latest deploy log https://app.netlify.com/projects/nx-docs/deploys/69fa5239cc228700081ef9b7
😎 Deploy Preview https://deploy-preview-35538--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.

@netlify
Copy link
Copy Markdown

netlify Bot commented May 1, 2026

Deploy Preview for nx-dev ready!

Name Link
🔨 Latest commit 27b3380
🔍 Latest deploy log https://app.netlify.com/projects/nx-dev/deploys/69fa52394cab760008df4332
😎 Deploy Preview https://deploy-preview-35538--nx-dev.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.

@nx-cloud
Copy link
Copy Markdown
Contributor

nx-cloud Bot commented May 1, 2026

View your CI Pipeline Execution ↗ for commit 27b3380

Command Status Duration Result
nx affected --targets=lint,test,build,e2e,e2e-c... ❌ Failed 19m 3s View ↗
nx run-many -t check-imports check-lock-files c... ✅ Succeeded 3s View ↗
nx-cloud record -- pnpm nx-cloud conformance:check ✅ Succeeded 17s View ↗
nx build workspace-plugin ✅ Succeeded <1s View ↗
nx-cloud record -- nx sync:check ✅ Succeeded 23s View ↗
nx-cloud record -- nx format:check ✅ Succeeded 6s View ↗

☁️ Nx Cloud last updated this comment at 2026-05-05 22:26:37 UTC

Migrates @nx/workspace to the local-dist build pattern, matching nx and
@nx/devkit. Required for the @nx/js migration in this PR to work
end-to-end — without it, @nx/js publishes with an unresolvable
@nx/workspace@0.0.1 dep and the local registry install in e2e fails.

Also adds a preflight step to the dist-build-migration skill that warns
about workspace:* deps on not-yet-migrated packages.
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