Scoped-Imports-In-A-Monorepo

Scoped Imports In A Monorepo Setup

Source
Better Source

As the name suggests since we're putting everything into a single repo, but we can stll partition out the different applications using scoped imports.

These are setup in the main tsconfig.json file where you have a block called references where you can put the package's referenced name with the path for that package.

For example

  "references": [
    {
      "name": "@fable/admin",
      "path": "apps/admin"
    },

This has the advantage of being able to import into your code using something like

import { ... } from '@fable/admin';

This also means you have the name set in the package's package.json file to "name": "fable/admin".

#JavaScript