Skip to content

chore(language-service): improve global types error message for JS projects #5574

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

Conversation

Ciallo-Chiaki
Copy link
Contributor

Description

Improved the global types error message to be more inclusive and helpful for both JavaScript and TypeScript projects.

Changes

  • Enhanced error message: Changed from "tsconfig.json" to "tsconfig.json or jsconfig.json" to support JavaScript projects
  • Added performance guidance: Included recommendation to add "exclude": ["node_modules"] when creating new config files to maintain VS Code performance
  • Better user experience: More comprehensive guidance for developers working with both JS and TS projects

Motivation

Problem Background

When users are in a non-npm like environment, they may be missing both the node_modules directory and TypeScript/JavaScript configuration files. The previous error message only mentioned tsconfig.json, which could confuse JavaScript developers who use jsconfig.json.

Performance Risk

More importantly, according to VS Code official documentation, VS Code will by default exclude the node_modules folder to optimize performance when there is no jsconfig.json in the workspace. When users create a new jsconfig.json to configure vueCompilerOptions.globalTypesPath following the error prompt, this changes VS Code's default behavior.

Potential Issues

If JavaScript project users don't explicitly add "exclude": ["node_modules"] when creating jsconfig.json, then when they subsequently install npm dependencies, the TypeScript/JavaScript language service will scan the entire node_modules directory, which may cause performance issues.

Solution

This improvement ensures that the prompt message is preventive and comprehensive, specifically targeting the performance risks of jsconfig.json, while maintaining unified recommendations for both types of configuration files, allowing users to solve the current problem without accidentally breaking VS Code's default performance optimization mechanism due to our suggestions.

Testing

  • Verified that the error message displays correctly

References

…ojects

- Include jsconfig.json alongside tsconfig.json in error message
- Add performance warning about excluding node_modules
- Better guidance for JavaScript projects using Vue language tools
Copy link

pkg-pr-new bot commented Aug 1, 2025

Open in StackBlitz

vue-component-meta

npm i https://pkg.pr.new/vuejs/language-tools/vue-component-meta@5574

vue-component-type-helpers

npm i https://pkg.pr.new/vuejs/language-tools/vue-component-type-helpers@5574

@vue/language-core

npm i https://pkg.pr.new/vuejs/language-tools/@vue/language-core@5574

@vue/language-plugin-pug

npm i https://pkg.pr.new/vuejs/language-tools/@vue/language-plugin-pug@5574

@vue/language-server

npm i https://pkg.pr.new/vuejs/language-tools/@vue/language-server@5574

@vue/language-service

npm i https://pkg.pr.new/vuejs/language-tools/@vue/language-service@5574

vue-tsc

npm i https://pkg.pr.new/vuejs/language-tools/vue-tsc@5574

@vue/typescript-plugin

npm i https://pkg.pr.new/vuejs/language-tools/@vue/typescript-plugin@5574

commit: ab9ff46

@KazariEX
Copy link
Member

KazariEX commented Aug 1, 2025

I think how to configure jsconfig falls outside the scope of this project. Simply adding jsconfig is sufficient.

If the user is not in an npm like environment, there is no need to exclude node_modules at all, since the folder would not exist. Otherwise, there is no need to manually configure this option in tsconfig or jsconfig.

@Ciallo-Chiaki
Copy link
Contributor Author

I think how to configure jsconfig falls outside the scope of this project. Simply adding jsconfig is sufficient.

If the user is not in an npm like environment, there is no need to exclude node_modules at all, since the folder would not exist. Otherwise, there is no need to manually configure this option in tsconfig or jsconfig.

Thank you for the feedback! I understand the scope concern, but when we guide users to create jsconfig.json, we inadvertently break VS Code's default node_modules exclusion behavior. Users often start in non-npm environments but later install dev tools, causing performance issues when VS Code scans the newly created node_modules. Since our error message changes this default behavior, maintaining good performance for users is our intention.

@KazariEX
Copy link
Member

KazariEX commented Aug 1, 2025

"non-npm like environment" does not refer to a state where node_modules has not been installed yet, but rather to a development setup where node_modules is not present by design, even when the environment is complete.

@Ciallo-Chiaki
Copy link
Contributor Author

"non-npm like environment" does not refer to a state where node_modules has not been installed yet, but rather to a development setup where node_modules is not present by design, even when the environment is complete.

Here's a real scenario: when I create a UniApp project, it doesn't include these files by default, but later I need utility libraries like xe-utils, which creates node_modules in the root directory, and as the project progresses, node_modules grows larger.

@KazariEX
Copy link
Member

KazariEX commented Aug 1, 2025

Had not considered that 😄. I will make some changes for merging.

@KazariEX KazariEX merged commit 2d51435 into vuejs:master Aug 1, 2025
6 checks passed
@Ciallo-Chiaki
Copy link
Contributor Author

Had not considered that 😄. I will make some changes for merging.

Thank you for your reply. It's my great honor to be of help!

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

Successfully merging this pull request may close these issues.

2 participants