Skip to content

Comments

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

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

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

Conversation

@BioPhoton
Copy link
Collaborator

@BioPhoton BioPhoton commented Feb 8, 2026

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:

export function registerTranspiler(
  compilerOptions: CompilerOptions,
  tsConfigRaw?: unknown
): () => void {
  const transpiler = getTranspiler(compilerOptions, tsConfigRaw);

  if (!transpiler) {
    warnNoTranspiler();
    return () => {};
  }

  return transpiler();
}

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-actions github-actions bot added 🦾 CI/CD Continuous integration and deployment 🛠️ tooling labels Feb 8, 2026
@nx-cloud
Copy link

nx-cloud bot commented Feb 8, 2026

View your CI Pipeline Execution ↗ for commit 39ec97d

Command Status Duration Result
nx run ci:code-pushup -- merge-diffs --files=/h... ✅ Succeeded 5s View ↗
nx run-many --targets=code-pushup --parallel=fa... ✅ Succeeded 1m 30s View ↗
nx run-many --targets=code-pushup --parallel=fa... ✅ Succeeded 13m 48s View ↗
nx run-many -t unit-test,int-test ✅ Succeeded 2m 3s View ↗

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

@pkg-pr-new
Copy link

pkg-pr-new bot commented Feb 8, 2026

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

github-actions bot commented Feb 8, 2026

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 packages npm audit 🔴 39 🔴 0 ↓ −38.7
Lighthouse Performance 🔴 36 🔴 47 ↑ +11.2
Lighthouse Best Practices 🟢 100 🟢 97 ↓ −3.4
JS packages npm outdated dependencies 🟡 75 🟡 72 ↓ −3.3

30 other groups are unchanged.

🛡️ Audits

🔌 Plugin 🛡️ Audit 📏 Previous value 📏 Current value 🔄 Value change
Lighthouse No issues in the Issues panel in Chrome Devtools 🟩 passed 🟥 failed ↓ −100 %
Lighthouse Reduce unused JavaScript 🟥 Potential savings of 225 KiB 🟨 Potential savings of 256 KiB ↓ −100 %
Lighthouse Remove duplicate modules in JavaScript bundles 🟥 Potential savings of 93 KiB 🟨 Potential savings of 69 KiB ↓ −100 %
JS packages Vulnerabilities for npm prod dependencies. 🟥 12 vulnerabilities (3 high, 2 moderate, 7 low) 🟥 22 vulnerabilities (13 high, 3 moderate, 6 low) ↑ +83.3 %
Lighthouse Largest Contentful Paint 🟥 11.6 s 🟥 4.5 s ↓ −61.2 %
Lighthouse Speed Index 🟥 7.3 s 🟥 6.0 s ↓ −17.6 %
JS packages Outdated 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 packages Outdated 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 %
Lighthouse Total Blocking Time 🟥 1,630 ms 🟥 1,540 ms ↓ −5.7 %
Lighthouse Time to Interactive 🟥 13.5 s 🟥 13.8 s ↑ +2 %
Lighthouse Avoids enormous network payloads 🟩 Total size was 2,091 KiB 🟩 Total size was 2,137 KiB ↑ +2.2 %
Lighthouse Minimizes main-thread work 🟥 10.3 s 🟥 9.4 s ↓ −8.8 %
Lighthouse Server Backend Latencies 🟩 310 ms 🟩 1,170 ms ↑ +275.4 %
Lighthouse Uses efficient cache policy on static assets 🟨 31 resources found 🟨 31 resources found ↑ +0.1 %
Lighthouse Metrics 🟩 100% 🟩 100% ↑ +2 %
Lighthouse JavaScript execution time 🟥 3.0 s 🟥 3.2 s ↑ +5.4 %
Lighthouse Reduce unused CSS 🟥 Potential savings of 111 KiB 🟥 Potential savings of 110 KiB ↑ +14.6 %
JS packages Vulnerabilities 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 %
Lighthouse First Contentful Paint 🟥 3.1 s 🟥 3.1 s ↑ +0.6 %
Lighthouse Max Potential First Input Delay 🟥 990 ms 🟥 1,000 ms ↑ +1 %
Lighthouse Network Round Trip Times 🟩 30 ms 🟩 20 ms ↓ −30.1 %
Lighthouse Avoids an excessive DOM size 🟥 2,366 elements 🟥 2,360 elements ↓ −0.3 %
Axe Elements must only use supported ARIA attributes 🟩 101 elements 🟩 96 elements ↓ −5 %
Axe ARIA attributes must be used as specified for the element's role 🟩 101 elements 🟩 96 elements ↓ −5 %
Axe Elements must only use permitted ARIA attributes 🟩 101 elements 🟩 96 elements ↓ −5 %
Axe ARIA attributes must conform to valid names 🟩 101 elements 🟩 96 elements ↓ −5 %
Lighthouse Initial server response time was short 🟩 Root document took 510 ms 🟩 Root document took 510 ms ↑ +0.8 %
Code coverage Line coverage 🟩 92.7 % 🟩 92.7 % ↓ −0.1 %
Lighthouse Cumulative Layout Shift 🟩 0 🟩 0 ↑ +∞ %

650 other audits are unchanged.

@github-actions
Copy link
Contributor

github-actions bot commented Feb 8, 2026

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 coverage Documentation coverage 🟡 60 🟡 60 ↑ +0.1

14 other groups are unchanged.

🛡️ Audits

All of 444 audits are unchanged.


13 other projects are unchanged.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant