We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
jsconfig.json的作用:对 JS 项目目录提供个性化支持:比如路径短写、引入文件自动完成等,能提升开发体验。
jsconfig.json
JS 项目
配置后需要重启 vs code。jsconfig.json 所在的目录是项目根目录。
exclude 属性,glob 模式,告诉语言服务哪些文件不是源码文件,能提高 vscode 扫描速度。
exclude
如果您的工作区中没有 jsconfig.json,VS Code 将默认排除 node_modules 文件夹。
include,属性,指定哪些路径或者文件是项目文件。
include
这两个属性都是为了提高智能感知的速度。
{ "exclude": ["node_modules", "dist"], "include": ["src/**/*"] }
路径跳转
webpack 配置路径别名,在引入文件时,vscode 无法感知路径的,也无法跳转文件,jsconfig 的别名路径解决这一问题。
无法跳转
只支持 js文件 和 jsx文件 跳转路径,.vue 不支持跳转,配置中发现路径别名也要配置vue.config.js才能找到模块,这样依赖,jsconfig 的配置就鸡肋了。
js文件
jsx文件
.vue
vue.config.js
{ "compilerOptions": { "baseUrl": ".", "paths": { "@component": ["./src/component"] }, "module": "commonjs", "target": "es6" } }
compilerOptions 选项
jsconfig 与 tsconfig.json 的关系?
jsconfig.json 是 tsconfig.json 的后代,后者是 TypeScript 的配置文件。
jsconfig.json 相当于 tsconfig.json 的“allowJs”属性设置为 true。
常用的配置选项:
{ "compilerOptions": { "baseUrl": ".", "paths": { "@component": ["./src/components"] }, "module": "commonjs", "target": "es6" }, "exclude": ["node_modules", "dist"], "include": ["src/**/*"] }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
vs code jsconfig 配置
jsconfig.json
的作用:对JS 项目
目录提供个性化支持:比如路径短写、引入文件自动完成等,能提升开发体验。配置详情
exclude
属性,glob 模式,告诉语言服务哪些文件不是源码文件,能提高 vscode 扫描速度。include
,属性,指定哪些路径或者文件是项目文件。webpack 配置路径别名,在引入文件时,vscode 无法感知路径的,也
无法跳转
文件,jsconfig 的别名路径解决这一问题。jsconfig.json 是 tsconfig.json 的后代,后者是 TypeScript 的配置文件。
jsconfig.json 相当于 tsconfig.json 的“allowJs”属性设置为 true。
常用的配置选项:
The text was updated successfully, but these errors were encountered: