Build using workspace is not correctly handling "extends" on tsconfig file

124 views Asked by At

At first I want to say I might be doing things wrong because I am using npm workspaces since yesterday. But I've read docs, asked GPT, and searched a lot of questions before making my own. So here I go. I have a monorepo from which I want to build my main repo and also, as my subrepos are widgets, I want to build them separately as well. My repo looks like this:

main
  ├  widgets
  |  ├  widget1
  |  |  └ package.json
  |  ├  widget2
  |  |  └ package.json
  |  └ package.json // (Here I reference "./*" as workspace. Also here I have a script I use to build widgets)
  └ package.json // (Here I reference "widgets" as a workspace)

I've tried several ways of installing dependencies, and it seems npm handles this job in a way it always depend on parent package node_modules to bring dependencies, this is all good as far as it works. I am expecting to run a script from "main" and develop the whole building process for each widget naturally.

My workflow is like this.

  1. I am at "main" path, here I run:
npm run buildscript -w widgets
  1. This uses a node script in "widgets" path that do several things including
npm run build -w widget1 // or 2 or 3...
  1. Here it fails with error
failed to resolve "extends":"@vue/tsconfig/tsconfig.dom.json" in C:/<...long long path>
// ... long long error

I think the problem has to do with workspaces because if I leave out all of the workspaces configuration and run npm install and npm build directly from my widget folder, it simply works. I think the build process is having problem to fetch the @vue/tsconfig dependency to fulfill the need of this "extends" indication in tsconfig.json

What do you think my problem is? Have you ever experienced something like this? Any tip?

0

There are 0 answers