Nuxt generated tsconfig point outside of project and language server crashes out of memory
Hi great devs, Im here to ask why nuxt adding folders way outside my nuxt project? It started since I moved to use layers. My nuxt project is kinda microfrontend for project which it inside of and vue language server crashing out of memory because it trying to typecheck files outside of nuxt project(there is many).
Im trying to understand what causing selected line to appear when i run postinstall script inside one layer
7 Replies
Hi @This is War Huh Wow. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
Based on the information provided in the knowledge sources, I can offer some insights into your issue with Nuxt's generated tsconfig and the out-of-memory crashes you're experiencing.
Nuxt automatically generates a
.nuxt/tsconfig.json
file with sensible defaults and aliases for your project. This file is intended to be extended by your project's tsconfig.json
. However, when using layers, the behavior can become more complex.
The issue you're experiencing with folders outside your Nuxt project being included might be related to how Nuxt handles layers. According to the Authoring Nuxt Layers documentation, Nuxt layers allow you to extend the default files, configs, and more. This can potentially cause unexpected behavior in TypeScript configuration.
To address the out-of-memory issues and unexpected inclusions, you could try the following:
1. Check your tsconfig.json
file and ensure it's extending the auto-generated config correctly:
2. Be cautious about overwriting options such as compilerOptions.paths
in your tsconfig.json
, as this can lead to module resolution issues. Instead, use the alias
property in your nuxt.config.ts
file to add path aliases Docs > Guide > Directory-structure > tsconfig.
3. If you need to customize your TypeScript configuration for layers, you might want to look into using the nuxt.options._layers
array in your module setup, as mentioned in the Multi-Layer Support for Nuxt Modules documentation.
4. Ensure you're using compatible versions of vue-tsc
and typescript
. There have been issues reported with certain versions not working correctly with Nuxt 3 Github Pull Request #26083.
If these steps don't resolve your issue, it might be helpful to review your layer configuration and ensure that it's not inadvertently including directories outside your project scope. Unfortunately, the knowledge sources don't provide specific information about why the postinstall script in one layer might cause unexpected inclusions. You may need to investigate the specific content of that layer and its configuration to understand why it's behaving this way.
If the problem persists, you might want to consider creating a minimal reproduction of the issue and seeking further assistance from the Nuxt community or filing an issue on the Nuxt GitHub repository.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@150865547922243584> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
if i move my entire nuxt app outside in different folder for example desktop, then with just this, path becomes
"../../**/*",
as i assume it should
why it even looks outside when im working inside my project???
i cant even make minimal repro because of this, when there is no unrelated project in path above it works normally.You’ll want to mention the bot for a response
I can't do anything about it 😞
Better find how to prevent this behavior