Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(js): allow inlined libs without imports #20649

Merged
merged 1 commit into from
Jan 30, 2024

Conversation

zbristow
Copy link
Contributor

@zbristow zbristow commented Dec 7, 2023

Our team has been working on some internal projects that typically get built with inlined libs. We came up with a generator to create our projects with presets including external, but since they're new projects they haven't imported any libs (yet!).

Current Behavior

When the external option for the @nx/js:tsc executor is set to all or none but the project doesn't import any libs, the build fails.

nx run example-app:build

Compiling TypeScript files for project "example-app"...
Done compiling TypeScript files for project "example-app".
node:internal/errors:496
    ErrorCaptureStackTrace(err);
    ^

TypeError [ERR_INVALID_ARG_TYPE]: The "to" argument must be of type string. Received undefined
    at new NodeError (node:internal/errors:405:5)
    at validateString (node:internal/validators:162:11)
    at relative (node:path:1191:5)
    at /Users/zbristow/projects/node_modules/@nx/js/src/utils/inline.js:182:60
    at String.replace (<anonymous>)
    at recursiveUpdateImport (/Users/zbristow/projects/node_modules/@nx/js/src/utils/inline.js:177:48)
    at recursiveUpdateImport (/Users/zbristow/projects/node_modules/@nx/js/src/utils/inline.js:188:13)
    at updateImports (/Users/zbristow/projects/node_modules/@nx/js/src/utils/inline.js:167:5)
    at postProcessInlinedDependencies (/Users/zbristow/projects/node_modules/@nx/js/src/utils/inline.js:54:5)
    at /Users/zbristow/projects/node_modules/@nx/js/src/executors/tsc/tsc.impl.js:73:53 {
  code: 'ERR_INVALID_ARG_TYPE'
}

Node.js v18.18.0

 ———

 >  NX   Ran target build for project example-app (4s)

    ✖    1/1 failed
    ✔    0/1 succeeded [0 read from cache]

Expected Behavior

Build the project successfully.

@zbristow zbristow requested a review from a team as a code owner December 7, 2023 19:18
Copy link

vercel bot commented Dec 7, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment
Name Status Preview Updated (UTC)
nx-dev ⬜️ Ignored (Inspect) Visit Preview Jan 29, 2024 5:06pm

Copy link

nx-cloud bot commented Dec 7, 2023

☁️ Nx Cloud Report

CI is running/has finished running commands for commit a928c8e. As they complete they will appear below. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this CI Pipeline Execution


✅ Successfully ran 1 target

Sent with 💌 from NxCloud.

Copy link
Member

@mandarini mandarini left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

makes sense to me, thanks

@mandarini mandarini self-assigned this Jan 29, 2024
@mandarini mandarini enabled auto-merge (squash) January 29, 2024 17:07
@mandarini mandarini merged commit 169a3f5 into nrwl:master Jan 30, 2024
6 checks passed
@zbristow zbristow deleted the inline-libs-without-imports branch January 31, 2024 00:40
FrozenPandaz pushed a commit that referenced this pull request Jan 31, 2024
Copy link

github-actions bot commented Feb 6, 2024

This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 6, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants