Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No tsconfig found in monorepo setup with Nuxt apps and modules #3232

Closed
trc-mathieu opened this issue May 29, 2023 · 5 comments
Closed

No tsconfig found in monorepo setup with Nuxt apps and modules #3232

trc-mathieu opened this issue May 29, 2023 · 5 comments

Comments

@trc-mathieu
Copy link

trc-mathieu commented May 29, 2023

monorepo-nuxt-volar-issue

Tried with Vue.volar v1.7.8 and v1.6.5 with Takeover mode

Here's the output of nuxi info

  • Operating System: Linux
  • Node Version: v18.15.0
  • Nuxt Version: 3.5.2
  • Nitro Version: 2.4.1
  • Package Manager: pnpm@8.5.0
  • Builder: vite

I attended the Nuxt workshop last week at the Vue conference and met @danielroe there. I showed him the issue I have within a monorepo and he suggested that I speak with @johnsoncodehk about this.

Here is a reproducible example->Monorepo-Nuxt-Volar

I have an apps/ folder and a packages folder with Nuxt apps and Nuxt modules and use pnpm workspaces.

If you select the file /packages/module2/module-clone.ts, it shows in the VS code information bar the No tsconfig. It seems pretty random and I haven't figured out what the problem is and would really appreciate your help on this.
If you select the /packages/module2/module.ts, the tsconfig file is found in the right folder.

Same behaviour for other files like

  • /packages/module2/runtime/plugin.ts -> No tsconfig
  • /packages/module2/runtime/AComponent.vue -> No tsconfig

Strangely, all the files within apps/ have a proper tsconfig match.

Note: I tried on windows and linux and I see the same issue. In another project that I am working on, sometimes selecting a file within a nuxt module would point to the tsconfig file at a completely different level like /apps/appX, by-passing the module tsconfig file. Maybe some caching issue on volar side?

@Nardjo
Copy link

Nardjo commented Jun 5, 2023

Hello,

try add in ./packages/module/tsconfig.json

{
  "extends": "./playground/.nuxt/tsconfig.json",
  "include": ["./playground/.nuxt/nuxt.d.ts", "./playground/**/*", "./src/**/*"]
}

@trc-mathieu
Copy link
Author

Great! This works as expected with this. I guess this could be added to the nuxt template. @danielroe, what do you think?

@danielroe
Copy link
Member

Looking at this, I think the issue is that module-clone is not included in the playground project, whose types we are extended for the folder. For this kind of scenario, we have the typescript.includeWorkspace option, which you can set globally for your monorepo by creating a .nuxtrc file at the root with the contents:

typescript.includeWorkspace=true

However, this may not be relevant much longer as I am exploring a different approach with the module builder (nuxt/starter#392).

@trc-mathieu
Copy link
Author

Ok great news! I tried with typescript.includeWorkspace=true but this doesn't seem to work. The include option works fine for now. I'll keep an eye on nuxt/starter#392

@samk-dev
Copy link

Hello,

try add in ./packages/module/tsconfig.json

{
  "extends": "./playground/.nuxt/tsconfig.json",
  "include": ["./playground/.nuxt/nuxt.d.ts", "./playground/**/*", "./src/**/*"]
}

this saved me, thanx man.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants