Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to set Vue alias path IntelliSense by vscode

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

Editor to share with you how to set vscode Vue alias path intelligent tips, I believe that most people do not know much, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!

When using Vue framework for project development, after configuring path aliases in vue.config.js, when introducing components, css, and static file paths to other pages, using path aliases will not intelligently prompt for paths. Although the Path Intellisense plug-in is installed in vscode, it doesn't work. This is prone to the problem of low energy caused by path misspelling, and at the same time, it will also reduce the efficiency of development.

Solution

Create the file jsconfig.json in the same directory where the project package.json is located to solve the problem that the alias path is not prompted. (after configuring the save file, you need to restart the editor to take effect. And it can only recognize files ending with .vue and .js, css files and other static files are still not prompted, not recommended! )

/ / .jsconfig.json {"compilerOptions": {"baseUrl": ".", "paths": {"@ /\ *":\ ['src/\ *'\], "a /\ *":\ ["src/assets/\ *"\], "c /\ *":\ ["src/components/\ *"\] ...}, "include":\ [. / src/\ *\ * /\ * .vue ",". / src/\ *\ * /\ * .js "\]," exclude ":\ [" node\ _ modules "\]}

Configure Path Intellisence in the setting.json of vscode (this scheme is the most preferred, can identify files in any format, and has the widest coverage. When the alias changes, you only need to modify the configuration)

/ / setting.json "path-intellisense.mappings": {"a": "${workspaceRoot} / src", "c": "${workspaceRoot} / src/components",...} above are all the contents of the article "how to set the Vue alias path Intelligent Tip for vscode". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report