DEV Community

Discussion on: TypeScript + Yarn Workspace Monorepo

Collapse
 
t7yang profile image
t7yang

You can check the node_modules folder first to make sure @my-organisation/common existed. Somehow after yarn install / update some packages just "disappear". If so, you can do a yarn install --force to force yarn install again.

Collapse
 
aralroca profile image
Aral Roca

In my case I checked an exist inside the node_modules, but without the dist folder.

Image description

shared package tsconfig.json:

{
  "compilerOptions": {
    "declaration": true,
    "declarationMap": true,
    "sourceMap": true,
    "composite": true,
    "outDir": "dist",
    "rootDir": "src"
  },
  "include": [
    "src"
  ]
}
Enter fullscreen mode Exit fullscreen mode

and shared package.json:

{
  "name": "shared",
  "version": "1.0.0",
  "license": "MIT",
  "main": "dist/index.js",
  "types": "dist/index.d.ts",
  "files": [
    "dist"
  ],
  "devDependencies": {
    "typescript": "4.9.5"
  }
}
Enter fullscreen mode Exit fullscreen mode

Do you know why this can happen? Thanks!

Thread Thread
 
aralroca profile image
Aral Roca

@t7yang I updated your example from typescript 3.8.3 to 4.9.5 and is not working either. Do you know how to fix it for TypeScript v.4.9.5?

Thread Thread
 
t7yang profile image
t7yang

have you run the build cmd? you need to build at least once to generate the dist folder. the final solution is run the tsc in your shared folder.

Collapse
 
wiseintrovert profile image
wiseintrovert

Thanks!