News for hackers. Stuff that matters.
Re:Best practices for TypeScript monorepo by bsimpson on Thursday August 25, 2022 @05:44PM (#32600316)
Using relative imports that ../ out of your package directory confuses TypeScript about which files are in-scope (and how to structure the resulting files). You can end up with weird shit like my-library/dist/my-library/index.js. (I'm sure you can configure your way out of this. That's a puzzle I haven't solved and don't intend to invest time into.)

Yarn Berry has a node_modules mode now, which makes it behave like Yarn Classic and NPM. It also allows you to import sibling projects in a monorepo:

    "peerDependencies": {
      "my-library": "workspace:*",
which means you can

    import { thing } from 'my-library'
and have it work as expected, even when my-library is a sibling project in your monorepo.

There are no comments on this comment yet.