Open keynmol opened 1 year ago
Yarn introduced a new installation strategy known as Plug'n'Play (PnP) starting from Yarn 2. It aims to address problems with the node_modules strategy used by traditional package managers like npm and Yarn 1.
The node_modules strategy works by creating a node_modules directory in your project root, where all your dependencies are installed. However, this can create problems because:
In our case, the TypeScript util parseJsonConfigFileContent tries to resolve the file @grafana/tsconfig/base.json using the traditional node_modules strategy, but it can't find it because Yarn PnP doesn't create a node_modules directory. To resolve this issue, we should use the PnP API provided by Yarn to resolve modules if PnP is enabled for the repo.
Thanks @valerybugakov, that's some awesome investigative work.
More breadcrumbs - unmerged PnP PR for typescript: https://github.com/microsoft/TypeScript/pull/35206/files
Yarn claim that this PR is automerged by their plugin compat module: https://github.com/yarnpkg/berry/tree/master/packages/plugin-compat
Enabled by default, but perhaps it doesn't patch the particular method we use
context
In some cases if you have
"extends": "@package"
intsconfig.json
, auto-indexer doesn't work, failing with, for example, whereas building normally works:repro
Quickest is
cd packages/grafana-ui && docker run -it -v (pwd):/sources -w /sources sourcegraph/scip-typescript:latest scip-typescript index
considerations
extends
doesn't work at all - the database for scip-typescript itself is perfectly indexable and it uses a shared config as well