Skip to content

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

Draft
BioPhoton wants to merge 5 commits intomainfrom
chore/run-nx-with-tsx
Draft

chore: use tsx when execution nx to have local plugins working#1242
BioPhoton wants to merge 5 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
  • CI - Set environment variables explicitly at workflow level
    • NODE_OPTIONS=--import tsx - Enables TypeScript execution
    • TSX_TSCONFIG_PATH=tsconfig.base.json - Resolves path aliases

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:

@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 700589e

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

☁️ Nx Cloud last updated this comment at 2026-02-08 16:14:13 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/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/models

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

@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 c1df40b with previous commit 3dbf378.

🕵️ See full comparison in Code PushUp portal 🔍

🏷️ Categories

🏷️ Category ⭐ Previous score ⭐ Current score 🔄 Score change
Performance 🔴 37 🔴 41 ↑ +4.7
Updates 🟡 78 🟡 75 ↓ −3
Bug prevention 🟡 75 🟡 75 ↓ −0.1
Axe Accessibility 🟡 88 🟡 88 ↓ −0.1
Code style 🟢 100 🟢 100
Code coverage 🟢 93 🟢 93
Security 🔴 47 🔴 47
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, 👍 8 audits improved, 👎 1 audit regressed, 21 audits changed without impacting score

🗃️ Groups

🔌 Plugin 🗃️ Group ⭐ Previous score ⭐ Current score 🔄 Score change
Lighthouse Performance 🔴 37 🔴 41 ↑ +4.7
JS packages npm outdated dependencies 🟡 78 🟡 75 ↓ −3

32 other groups are unchanged.

🛡️ Audits

🔌 Plugin 🛡️ Audit 📏 Previous value 📏 Current value 🔄 Value change
Lighthouse Defer offscreen images 🟨 Potential savings of 16 KiB 🟩 0  −∞ %
Lighthouse Minify CSS 🟨 Potential savings of 10 KiB 🟩 0  −∞ %
Lighthouse First Contentful Paint 🟥 3.5 s 🟨 2.9 s ↓ −17.8 %
Lighthouse Speed Index 🟥 7.3 s 🟥 6.2 s ↓ −15.9 %
Lighthouse Max Potential First Input Delay 🟥 1,080 ms 🟥 520 ms ↓ −51.5 %
Lighthouse Time to Interactive 🟥 13.4 s 🟥 11.7 s ↓ −12.7 %
Lighthouse Total Blocking Time 🟥 1,310 ms 🟥 1,150 ms ↓ −12.4 %
JS packages Outdated npm prod dependencies. 🟨 20 outdated package versions (5 major, 11 minor, 4 patch) 🟨 20 outdated package versions (6 major, 10 minor, 4 patch)  +0 %
JS packages Outdated npm dev dependencies. 🟨 62 outdated package versions (29 major, 25 minor, 8 patch) 🟨 62 outdated package versions (29 major, 25 minor, 8 patch)  +0 %
Lighthouse Avoids enormous network payloads 🟩 Total size was 2,119 KiB 🟩 Total size was 2,057 KiB ↓ −2.9 %
Lighthouse Uses efficient cache policy on static assets 🟨 31 resources found 🟨 18 resources found ↓ −5.1 %
Lighthouse Minimizes main-thread work 🟥 10.2 s 🟥 7.5 s ↓ −26.2 %
Lighthouse Largest Contentful Paint 🟥 12.3 s 🟥 10.3 s ↓ −16.3 %
Lighthouse Metrics 🟩 100% 🟩 100% ↓ −12.7 %
Lighthouse JavaScript execution time 🟥 3.2 s 🟥 2.3 s ↓ −27 %
Lighthouse Server Backend Latencies 🟩 1,220 ms 🟩 980 ms ↓ −19.6 %
Lighthouse Remove duplicate modules in JavaScript bundles 🟥 Potential savings of 91 KiB 🟥 Potential savings of 93 KiB ↓ −31.1 %
Lighthouse Reduce unused CSS 🟥 Potential savings of 146 KiB 🟥 Potential savings of 111 KiB ↓ −21.7 %
Lighthouse Initial server response time was short 🟩 Root document took 560 ms 🟩 Root document took 440 ms ↓ −22 %
Lighthouse Reduce unused JavaScript 🟥 Potential savings of 225 KiB 🟥 Potential savings of 225 KiB ↓ −11.4 %
Lighthouse Network Round Trip Times 🟩 70 ms 🟩 10 ms ↓ −91.1 %
Lighthouse Avoids an excessive DOM size 🟥 2,366 elements 🟥 2,327 elements ↓ −1.6 %
Axe <li> elements must be contained in a <ul> or <ol> 🟩 65 elements 🟩 52 elements ↓ −20 %
Axe Interactive controls must not be nested 🟩 60 elements 🟩 47 elements ↓ −21.7 %
Axe Elements must only use supported ARIA attributes 🟩 100 elements 🟩 89 elements ↓ −11 %
Axe ARIA attributes must be used as specified for the element's role 🟩 100 elements 🟩 89 elements ↓ −11 %
Axe Elements must only use permitted ARIA attributes 🟩 100 elements 🟩 89 elements ↓ −11 %
Axe ARIA attributes must conform to valid names 🟩 100 elements 🟩 89 elements ↓ −11 %
JS packages Vulnerabilities for npm dev dependencies. 🟥 47 vulnerabilities (3 critical, 9 high, 32 moderate, 3 low) 🟥 48 vulnerabilities (3 critical, 9 high, 32 moderate, 4 low) ↑ +2.1 %
Lighthouse Cumulative Layout Shift 🟩 0 🟩 0.003 ↑ +∞ %

649 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 c1df40b with previous commit 3dbf378.

💼 Project utils

🥳 Code PushUp report has improved.

🕵️ See full comparison in Code PushUp portal 🔍

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

5 other categories are unchanged.

👍 1 group improved

🗃️ Groups

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

14 other groups are unchanged.

🛡️ Audits

All of 444 audits are unchanged.


13 other projects are unchanged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🦾 CI/CD Continuous integration and deployment 🛠️ tooling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant