Skip to content

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

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

chore: use tsx when execution nx to have local plugins working#1242
BioPhoton wants to merge 10 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 1016633

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 25s View ↗
nx run-many --targets=code-pushup --parallel=fa... ✅ Succeeded 13m 46s View ↗
nx run-many -t unit-test,int-test ✅ Succeeded 1m 58s View ↗

☁️ Nx Cloud last updated this comment at 2026-02-08 21:55:19 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/nx-plugin

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

@code-pushup/axe-plugin

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

@code-pushup/coverage-plugin

npm i https://pkg.pr.new/code-pushup/cli/@code-pushup/coverage-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

@code-pushup/eslint-plugin

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

commit: 1016633

@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 14f02ae with previous commit 3137af7.

🕵️ See full comparison in Code PushUp portal 🔍

🏷️ Categories

🏷️ Category ⭐ Previous score ⭐ Current score 🔄 Score change
Performance 🔴 40 🔴 39 ↓ −0.5
Code coverage 🟢 93 🟢 93 ↑ +0.1
Bug prevention 🟡 75 🟡 75 ↓ −0.1
Axe Accessibility 🟡 88 🟡 88 ↓ −0.1
Code style 🟢 100 🟢 100
Security 🔴 47 🔴 47
Updates 🟡 75 🟡 75
Type Safety 🟡 67 🟡 67
Miscellaneous 🟡 67 🟡 67
Documentation 🟡 53 🟡 53
Accessibility 🟢 92 🟢 92
Best Practices 🟢 100 🟢 100
SEO 🟢 92 🟢 92
👍 1 group improved, 👎 1 group regressed, 👍 3 audits improved, 👎 1 audit regressed, 14 audits changed without impacting score

🗃️ Groups

🔌 Plugin 🗃️ Group ⭐ Previous score ⭐ Current score 🔄 Score change
Lighthouse Performance 🔴 40 🔴 39 ↓ −0.5
Code coverage Code coverage metrics 🟢 93 🟢 93 ↑ +0.1

32 other groups are unchanged.

🛡️ Audits

🔌 Plugin 🛡️ Audit 📏 Previous value 📏 Current value 🔄 Value change
Lighthouse Total Blocking Time 🟥 1,040 ms 🟥 1,130 ms ↑ +8.3 %
Lighthouse Max Potential First Input Delay 🟥 620 ms 🟥 600 ms ↓ −4.3 %
Lighthouse First Contentful Paint 🟥 3.3 s 🟥 3.3 s ↓ −0.4 %
Code coverage Branch coverage 🟨 89.2 % 🟨 89.2 % ↑ +0.1 %
Lighthouse Avoids enormous network payloads 🟩 Total size was 2,089 KiB 🟩 Total size was 2,097 KiB ↑ +0.4 %
Lighthouse Server Backend Latencies 🟩 300 ms 🟩 840 ms ↑ +184.5 %
Lighthouse Reduce unused JavaScript 🟥 Potential savings of 225 KiB 🟥 Potential savings of 202 KiB ↓ −12.5 %
Lighthouse Uses efficient cache policy on static assets 🟨 31 resources found 🟨 31 resources found ↓ −0.1 %
Lighthouse Largest Contentful Paint 🟥 11.7 s 🟥 11.8 s ↑ +1.2 %
Lighthouse Minimizes main-thread work 🟥 8.1 s 🟥 8.0 s ↓ −0.9 %
Lighthouse Initial server response time was short 🟥 Root document took 660 ms 🟥 Root document took 620 ms ↓ −6.1 %
Lighthouse Speed Index 🟥 6.8 s 🟥 6.9 s ↑ +0.5 %
Lighthouse Metrics 🟩 100% 🟩 100% ↑ +0.2 %
Lighthouse Time to Interactive 🟥 13.1 s 🟥 13.1 s ↑ +0.2 %
Lighthouse JavaScript execution time 🟥 2.1 s 🟥 2.1 s ↓ −0.9 %
Lighthouse Network Round Trip Times 🟩 70 ms 🟩 80 ms ↑ +3.1 %
Code coverage Line coverage 🟩 92.8 % 🟩 92.8 % ↓ −0.1 %
Lighthouse Cumulative Layout Shift 🟩 0.003 🟩 0 ↓ −100 %

661 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 14f02ae with previous commit 3137af7.

💼 Project utils

🥳 Code PushUp report has improved.

🕵️ See full comparison in Code PushUp portal 🔍

🏷️ Category ⭐ Previous score ⭐ Current score 🔄 Score change
Code coverage 🟢 95 🟢 95 ↑ +0.1
Documentation 🟡 61 🟡 61 ↑ +0.1

4 other categories are unchanged.

👍 2 groups improved, 👍 1 audit improved

🗃️ Groups

🔌 Plugin 🗃️ Group ⭐ Previous score ⭐ Current score 🔄 Score change
Code coverage Code coverage metrics 🟢 95 🟢 95 ↑ +0.1
JSDocs coverage Documentation coverage 🟡 61 🟡 61 ↑ +0.1

13 other groups are unchanged.

🛡️ Audits

🔌 Plugin 🛡️ Audit 📏 Previous value 📏 Current value 🔄 Value change
Code coverage Branch coverage 🟩 91.9 % 🟩 91.9 % ↑ +0.1 %

443 other audits are unchanged.

💼 Project plugin-lighthouse

🤨 Code PushUp report has both improvements and regressions.

🕵️ See full comparison in Code PushUp portal 🔍

All of 6 categories are unchanged.

1 audit changed without impacting score

🗃️ Groups

All of 15 groups are unchanged.

🛡️ Audits

🔌 Plugin 🛡️ Audit 📏 Previous value 📏 Current value 🔄 Value change
Code coverage Branch coverage 🟩 98.8 % 🟩 98.8 % ↑ +0.1 %

443 other audits are unchanged.


12 other projects are unchanged.

@github-actions github-actions bot removed the 🦾 CI/CD Continuous integration and deployment label Feb 8, 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