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

Typescript 4.4.2 with yarn 3.x. Cannot find modules #45681

Closed
gizmooo opened this issue Sep 1, 2021 · 6 comments
Closed

Typescript 4.4.2 with yarn 3.x. Cannot find modules #45681

gizmooo opened this issue Sep 1, 2021 · 6 comments

Comments

@gizmooo
Copy link

gizmooo commented Sep 1, 2021

Bug Report

typescript cannot find all installed dependencies

sc

🔎 Search Terms

yarn imports

🕗 Version & Regression Information

  • does not work yarn v3.0.1 & typescrtipt v4.4.2
  • works with yarn v3.0.1 & typescript v4.3.5
  • works with npm & typescrtipt v4.4.2

💻 Code

{
  "compilerOptions": {
    "lib": [
      "WebWorker",
      "DOM",
      "DOM.Iterable",
      "ESNext",
      "ScriptHost"
    ],
    "allowJs": true,
    "skipLibCheck": true,
    "esModuleInterop": true,
    "allowSyntheticDefaultImports": true,
    "strict": true,
    "forceConsistentCasingInFileNames": true,
    "module": "esnext",
    "moduleResolution": "node",
    "resolveJsonModule": true,
    "isolatedModules": false,
    "noEmit": false,
    "target": "es2017",
    "sourceMap": true,
    "outDir": "prod/build",
    "baseUrl": "./",
    "paths": {
      "MEDIA/*": ["dev/media/*"],
      "IMAGES/*": ["dev/media/images/*"],
      "TYPES/*": ["dev/js/types/*"]
    }
  },
  "exclude": ["node_modules"],
  "files": [
    "./dev/js/entry.ts"
  ],
  "include": ["dev", "./dev/js/global.d.ts"]
}

🙁 Actual behavior

Typescript v.4.4.x does not work with yarn version 3.x

🙂 Expected behavior

Typescript v.4.4.x finds all dependencies with yarn 3.x

@DanielRosenwasser
Copy link
Member

DanielRosenwasser commented Sep 1, 2021

Looks like Yarn Plug'n'Play might have had to specially handle TS4.4. Check out yarnpkg/berry#3350.

According to yarnpkg/berry#3372 (comment), you might be able to get around it by running

yarn set version canary && yarn

Can you give it a shot?

@gizmooo
Copy link
Author

gizmooo commented Sep 1, 2021

Yeah! it really works! Thanks

@gizmooo gizmooo closed this as completed Sep 1, 2021
@merceyz
Copy link

merceyz commented Sep 1, 2021

Looks like Yarn Plug'n'Play might have had to specially handle TS4.4

Sadly we have to rebuild the patch (#35206) for almost every minor TypeScript release
https://github.com/yarnpkg/berry/blob/464618c2f7baba46a79d66849c1eda00cad1132e/packages/plugin-compat/extra/typescript/gen-typescript-patch.js#L18-L80

@gizmooo
Copy link
Author

gizmooo commented Sep 4, 2021

Yarn released version 3.0.2 compatible with 4.4.x typescript :)

yarn set version latest

@eltonio450
Copy link

it seems to work on Mac but not on Linux (WSL)

how does the patch rebuild work? It seems to be related to a resolution hash that is not the same on both platforms

below is the diff in my yarn.lock when I yarn install on Linux after it has been done on Mac

image

I am not sure If it is related to this issue or yarn itself

thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants
@DanielRosenwasser @merceyz @eltonio450 @gizmooo and others