Skip to content

Instantly share code, notes, and snippets.

@GavinRay97
Created September 1, 2020 17:23
Show Gist options
  • Save GavinRay97/54169f2847ab057a1b5edf8cfd506bdb to your computer and use it in GitHub Desktop.
Save GavinRay97/54169f2847ab057a1b5edf8cfd506bdb to your computer and use it in GitHub Desktop.
Yarn 2 Berry notes - VS Code, Typescript, node_modules compatibility

Set yarn to use V2/Berry in project:

  • yarn set version berry

Add Typescript plugin for automatically fetching @types/<pkg> definition when package doesn't include them:

  • yarn plugin import typescript

To use the PnP setup with VS Code, and not retain node_modules compatibility, run:

  • yarn add @yarnpkg/pnpify --dev
  • yarn pnpify --sdk vscode

Alternatively, just configure .yarnrc.yml to use node_modules:

nodeLinker: node-modules
yarnPath: .yarn/releases/yarn-berry.cjs

plugins:
  - path: .yarn/plugins/@yarnpkg/plugin-typescript.cjs
    spec: "@yarnpkg/plugin-typescript"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment