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

@nx/js:tsc build fails on Windows with Yarn PnP after 19.6.1 #27656

Closed
1 of 4 tasks
fpaul-1A opened this issue Aug 27, 2024 · 3 comments · Fixed by #28083
Closed
1 of 4 tasks

@nx/js:tsc build fails on Windows with Yarn PnP after 19.6.1 #27656

fpaul-1A opened this issue Aug 27, 2024 · 3 comments · Fixed by #28083

Comments

@fpaul-1A
Copy link

Current Behavior

Typescript compilation fails when migrating from nx 19.6.0 to 19.6.1 on Windows with Yarn PnP

 NX   Running target build for project mylib

   ×  nx run mylib:build
      Compiling TypeScript files for project "mylib"...
      /git_clones/test-nx-pnp-windows/packages/mylib/src/index.ts:1:1 - error TS2354: This syntax requires an imported helper but module 'tslib' cannot be found.

      1 export * from './lib/mylib';
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      /git_clones/test-nx-pnp-windows/packages/mylib/src/lib/mylib.ts:1:25 - error TS2307: Cannot find module 'semver' or its corresponding type declarations.

      1 import * as semver from 'semver';

Expected Behavior

The build should be successful as on 19.6.0

GitHub Repo

https://github.com/fpaul-1A/test-nx-pnp-windows/tree/19.6.1

Steps to Reproduce

  1. git clone https://github.com/fpaul-1A/test-nx-pnp-windows/tree/19.6.1
  2. yarn install
  3. yarn build

Nx Report

NX   Report complete - copy this into the issue template

Node           : 20.14.0
OS             : win32-x64
Native Target  : x86_64-windows
yarn           : 4.4.1

nx          : 19.6.1
@nx/js      : 19.6.1
typescript  : 5.5.4

Failure Logs

No response

Package Manager Version

No response

Operating System

  • macOS
  • Linux
  • Windows
  • Other (Please specify)

Additional Information

The issue doesn't appear with nodeLinker: node-modules.
Also, it seems to be somehow related to this modification #27300, the build succeeds when reverting the change on tsc.impl.ts

@jaysoo
Copy link
Member

jaysoo commented Sep 25, 2024

It looks like tslib is not installed in your workspace, but importHelpers is true in tsconfig. Can you install it and check if the build succeeds?

@jaysoo jaysoo closed this as completed in 37523fa Sep 25, 2024
FrozenPandaz pushed a commit that referenced this issue Sep 26, 2024
…rue (#28083)

<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
Sometimes tslib is missing even though it is needed for typechecks.

## Expected Behavior
tslib is installed when needed. i.e. `importHelpers: true`

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #27656
@fpaul-1A
Copy link
Author

fpaul-1A commented Sep 26, 2024

It looks like tslib is not installed in your workspace, but importHelpers is true in tsconfig. Can you install it and check if the build succeeds?

Hello, thanks for the reply
tslib is present in the dependencies of the project mylib
Adding it at the root of the workspace doesn't seem to fix the problem :(

This is working as expected either on 19.6.0 or in 19.6.1 without PnP without adding the dependency at root level

I also tried with 19.8.2 and still experience the same error.

Copy link

This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.

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

Successfully merging a pull request may close this issue.

2 participants