Skip to content

chore: use tsx when execution nx to have local plugins working - #1242

Open
BioPhoton wants to merge 14 commits into
mainfrom
chore/run-nx-with-tsx
Open

chore: use tsx when execution nx to have local plugins working#1242
BioPhoton wants to merge 14 commits into
mainfrom
chore/run-nx-with-tsx

Conversation

@BioPhoton

@BioPhotonBioPhoton commented Feb 8, 2026

Copy link
Copy Markdown
Collaborator

Problem
This repository uses local Nx plugins and async generators written in TypeScript that need to:

  • Import files with .js extensions (ES modules convention)
  • Resolve TypeScript path aliases (e.g., @code-pushup/models)

Without proper TypeScript execution setup, Nx commands fail when trying to execute these local plugins/generators.

Solution
Explicit environment variable configuration for both local development and CI:

  • Local Development - Use .env.local (gitignored)
  • Developers copy .env.local.example to .env.local
  • Nx automatically loads .env.local files

Background

Why SWC is skipped when running Nx with NODE_OPTIONS="--import tsx"

Nx has hardcoded transpiler-selection logic for local TS/TSX execution (plugins, executors, generators).
When running with a Node loader like tsx, Nx does not register SWC, even if SWC is available.

Relevant source:
https://github.com/nrwl/nx/blob/81c157d0631927b3d1891453aa45652f3b5a7988/packages/nx/src/plugins/js/utils/register.ts

Key logic:

exportfunctionregisterTranspiler(compilerOptions: CompilerOptions,tsConfigRaw?: unknown): ()=>void{consttranspiler=getTranspiler(compilerOptions,tsConfigRaw);if(!transpiler){warnNoTranspiler();return()=>{};}returntranspiler();}

If getTranspiler(...) returns undefined, Nx intentionally does not register SWC or ts-node.

getTranspiler(...) only detects:

  • @swc-node/register
  • ts-node

Node loaders like tsx are not detected, so:

  • getTranspiler(...) === undefined
  • registerTranspiler becomes a no-op
  • SWC is effectively disabled by design for this execution path

This is not in @nx/js:swc, but in Nx’s runtime TS/TSX plugin execution pipeline.
Running with NODE_OPTIONS="--import tsx" therefore bypasses SWC via hardcoded logic.

Related:

Closes#1238

@github-actionsgithub-actionsBot added 🦾 CI/CD Continuous integration and deployment 🛠️ tooling labels Feb 8, 2026
@nx-cloud

nx-cloudBot commented Feb 8, 2026

Copy link
Copy Markdown

View your CI Pipeline Execution ↗ for commit 39ec97d

CommandStatusDurationResult
nx run ci:code-pushup -- merge-diffs --files=/h...✅ Succeeded5sView ↗
nx run-many --targets=code-pushup --parallel=fa...✅ Succeeded1m 30sView ↗
nx run-many --targets=code-pushup --parallel=fa...✅ Succeeded13m 48sView ↗
nx run-many -t unit-test,int-test✅ Succeeded2m 3sView ↗

☁️ Nx Cloud last updated this comment at 2026-02-23 13:45:30 UTC

@pkg-pr-new

pkg-pr-newBot commented Feb 8, 2026

Copy link
Copy Markdown

Open in StackBlitz

@code-pushup/ci

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/ci@1242

@code-pushup/cli

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/cli@1242

@code-pushup/core

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/core@1242

@code-pushup/create-cli

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/create-cli@1242

@code-pushup/models

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/models@1242

@code-pushup/axe-plugin

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/axe-plugin@1242

@code-pushup/nx-plugin

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/nx-plugin@1242

@code-pushup/coverage-plugin

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/coverage-plugin@1242

@code-pushup/eslint-plugin

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/eslint-plugin@1242

@code-pushup/js-packages-plugin

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/js-packages-plugin@1242

@code-pushup/jsdocs-plugin

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/jsdocs-plugin@1242

@code-pushup/lighthouse-plugin

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/lighthouse-plugin@1242

@code-pushup/typescript-plugin

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/typescript-plugin@1242

@code-pushup/utils

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/utils@1242

commit: 39ec97d

@github-actions

github-actionsBot commented Feb 8, 2026

Copy link
Copy Markdown
Contributor

Code PushUp

🤨 Code PushUp report has both improvements and regressions – compared current commit 0bbda72 with previous commit dd6e35e.

🕵️ See full comparison in Code PushUp portal 🔍

🏷️ Categories

🏷️ Category⭐ Previous score⭐ Current score🔄 Score change
Security🔴 39🔴 0↓ −38.7
Performance🔴 36🔴 47↑ +11.2
Best Practices🟢 100🟢 97↓ −3.4
Updates🟡 75🟡 72↓ −3.3
Bug prevention🟡 75🟡 75↓ −0.1
Axe Accessibility🟡 88🟡 88↓ −0.1
Code style🟢 100🟢 100
Code coverage🟢 93🟢 93
Type Safety🟡 67🟡 67
Miscellaneous🟡 67🟡 67
Documentation🟡 53🟡 53
Accessibility🟢 92🟢 92
SEO🟢 92🟢 92
👍 1 group improved, 👎 3 groups regressed, 👍 5 audits improved, 👎 5 audits regressed, 19 audits changed without impacting score

🗃️ Groups

🔌 Plugin🗃️ Group⭐ Previous score⭐ Current score🔄 Score change
JS packagesnpm audit🔴 39🔴 0↓ −38.7
LighthousePerformance🔴 36🔴 47↑ +11.2
LighthouseBest Practices🟢 100🟢 97↓ −3.4
JS packagesnpm outdated dependencies🟡 75🟡 72↓ −3.3

30 other groups are unchanged.

🛡️ Audits

🔌 Plugin🛡️ Audit📏 Previous value📏 Current value🔄 Value change
LighthouseNo issues in the Issues panel in Chrome Devtools🟩 passed🟥 failed↓ −100 %
LighthouseReduce unused JavaScript🟥 Potential savings of 225 KiB🟨 Potential savings of 256 KiB↓ −100 %
LighthouseRemove duplicate modules in JavaScript bundles🟥 Potential savings of 93 KiB🟨 Potential savings of 69 KiB↓ −100 %
JS packagesVulnerabilities for npm prod dependencies.🟥 12 vulnerabilities (3 high, 2 moderate, 7 low)🟥 22 vulnerabilities (13 high, 3 moderate, 6 low)↑ +83.3 %
LighthouseLargest Contentful Paint🟥 11.6 s🟥 4.5 s↓ −61.2 %
LighthouseSpeed Index🟥 7.3 s🟥 6.0 s↓ −17.6 %
JS packagesOutdated npm prod dependencies.🟨 20 outdated package versions (6 major, 10 minor, 4 patch)🟨 21 outdated package versions (7 major, 11 minor, 3 patch)↑ +5 %
JS packagesOutdated npm dev dependencies.🟨 62 outdated package versions (29 major, 25 minor, 8 patch)🟨 61 outdated package versions (30 major, 25 minor, 6 patch)↓ −1.6 %
LighthouseTotal Blocking Time🟥 1,630 ms🟥 1,540 ms↓ −5.7 %
LighthouseTime to Interactive🟥 13.5 s🟥 13.8 s↑ +2 %
LighthouseAvoids enormous network payloads🟩 Total size was 2,091 KiB🟩 Total size was 2,137 KiB↑ +2.2 %
LighthouseMinimizes main-thread work🟥 10.3 s🟥 9.4 s↓ −8.8 %
LighthouseServer Backend Latencies🟩 310 ms🟩 1,170 ms↑ +275.4 %
LighthouseUses efficient cache policy on static assets🟨 31 resources found🟨 31 resources found↑ +0.1 %
LighthouseMetrics🟩 100%🟩 100%↑ +2 %
LighthouseJavaScript execution time🟥 3.0 s🟥 3.2 s↑ +5.4 %
LighthouseReduce unused CSS🟥 Potential savings of 111 KiB🟥 Potential savings of 110 KiB↑ +14.6 %
JS packagesVulnerabilities for npm dev dependencies.🟥 48 vulnerabilities (3 critical, 9 high, 32 moderate, 4 low)🟥 81 vulnerabilities (3 critical, 65 high, 10 moderate, 3 low)↑ +68.8 %
LighthouseFirst Contentful Paint🟥 3.1 s🟥 3.1 s↑ +0.6 %
LighthouseMax Potential First Input Delay🟥 990 ms🟥 1,000 ms↑ +1 %
LighthouseNetwork Round Trip Times🟩 30 ms🟩 20 ms↓ −30.1 %
LighthouseAvoids an excessive DOM size🟥 2,366 elements🟥 2,360 elements↓ −0.3 %
AxeElements must only use supported ARIA attributes🟩 101 elements🟩 96 elements↓ −5 %
AxeARIA attributes must be used as specified for the element's role🟩 101 elements🟩 96 elements↓ −5 %
AxeElements must only use permitted ARIA attributes🟩 101 elements🟩 96 elements↓ −5 %
AxeARIA attributes must conform to valid names🟩 101 elements🟩 96 elements↓ −5 %
LighthouseInitial server response time was short🟩 Root document took 510 ms🟩 Root document took 510 ms↑ +0.8 %
Code coverageLine coverage🟩 92.7 %🟩 92.7 %↓ −0.1 %
LighthouseCumulative Layout Shift🟩 0🟩 0↑ +∞ %

650 other audits are unchanged.

@github-actions

github-actionsBot commented Feb 8, 2026

Copy link
Copy Markdown
Contributor

Code PushUp

🥳 Code PushUp report has improved – compared current commit 0bbda72 with previous commit dd6e35e.

💼 Project utils

🥳 Code PushUp report has improved.

🕵️ See full comparison in Code PushUp portal 🔍

🏷️ Category⭐ Previous score⭐ Current score🔄 Score change
Documentation🟡 60🟡 60↑ +0.1

5 other categories are unchanged.

👍 1 group improved

🗃️ Groups

🔌 Plugin🗃️ Group⭐ Previous score⭐ Current score🔄 Score change
JSDocs coverageDocumentation coverage🟡 60🟡 60↑ +0.1

14 other groups are unchanged.

🛡️ Audits

All of 444 audits are unchanged.


13 other projects are unchanged.

@github-actionsgithub-actionsBot removed the 🦾 CI/CD Continuous integration and deployment label Feb 8, 2026
@github-actionsgithub-actionsBot added the 🔬 testing writing tests label Feb 23, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@BioPhoton