chore: use tsx when execution nx to have local plugins working#1242
Draft
chore: use tsx when execution nx to have local plugins working#1242
Conversation
|
View your CI Pipeline Execution ↗ for commit 700589e
☁️ Nx Cloud last updated this comment at |
@code-pushup/ci
@code-pushup/cli
@code-pushup/core
@code-pushup/create-cli
@code-pushup/nx-plugin
@code-pushup/axe-plugin
@code-pushup/models
@code-pushup/coverage-plugin
@code-pushup/eslint-plugin
@code-pushup/js-packages-plugin
@code-pushup/jsdocs-plugin
@code-pushup/lighthouse-plugin
@code-pushup/typescript-plugin
@code-pushup/utils
commit: |
Contributor
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👍 1 group improved, 👎 1 group regressed, 👍 8 audits improved, 👎 1 audit regressed, 21 audits changed without impacting score🗃️ Groups
32 other groups are unchanged. 🛡️ Audits
649 other audits are unchanged. |
Contributor
Code PushUp🥳 Code PushUp report has improved – compared current commit c1df40b with previous commit 3dbf378. 💼 Project
|
| 🏷️ Category | ⭐ Previous score | ⭐ Current score | 🔄 Score change |
|---|---|---|---|
| Documentation | 🟡 61 | 🟡 61 |
5 other categories are unchanged.
👍 1 group improved
🗃️ Groups
| 🔌 Plugin | 🗃️ Group | ⭐ Previous score | ⭐ Current score | 🔄 Score change |
|---|---|---|---|---|
| JSDocs coverage | Documentation coverage | 🟡 61 | 🟡 61 |
14 other groups are unchanged.
🛡️ Audits
All of 444 audits are unchanged.
13 other projects are unchanged.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
This repository uses local Nx plugins and async generators written in TypeScript that need to:
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:
.env.local(gitignored).env.local.exampleto.env.local.env.localfilesNODE_OPTIONS=--import tsx- Enables TypeScript executionTSX_TSCONFIG_PATH=tsconfig.base.json- Resolves path aliasesBackground
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:
If
getTranspiler(...)returnsundefined, Nx intentionally does not register SWC or ts-node.getTranspiler(...)only detects:@swc-node/registerts-nodeNode loaders like
tsxare not detected, so:getTranspiler(...) === undefinedregisterTranspilerbecomes a no-opThis 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: