最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Is my jsconfig.json not working in Visual Studio Code? - Stack Overflow

programmeradmin0浏览0评论

I have added a jsconfig.json in the root of my javascript project to try and exclude some build files as well as set some path mappings but nothing seems to happen. Part of the problem is that I'm not sure what the expected oute is when using a jsconfig.json, I've read the documentation for it but it does not demonstrate any of the results.

Can someone provide me with a small and working jsconfig.json with a description of what it actually does? So that I can use it to verify that it actually works in my project as well.

Or, does someone know of a way to verify that a jsconfig.json is working/picked up by VS Code?

I have added a jsconfig.json in the root of my javascript project to try and exclude some build files as well as set some path mappings but nothing seems to happen. Part of the problem is that I'm not sure what the expected oute is when using a jsconfig.json, I've read the documentation for it but it does not demonstrate any of the results.

Can someone provide me with a small and working jsconfig.json with a description of what it actually does? So that I can use it to verify that it actually works in my project as well.

Or, does someone know of a way to verify that a jsconfig.json is working/picked up by VS Code?

Share Improve this question edited Jun 20, 2020 at 9:12 CommunityBot 11 silver badge asked May 7, 2017 at 19:24 Karl ThunbergKarl Thunberg 911 silver badge4 bronze badges 2
  • You wrote, "but nothing seems to happen." What are you expecting to happen? – Shaun Luttin Commented May 8, 2017 at 17:07
  • 1 @shaun-luttin For the exclude property I was hoping it would exclude files and folders from the Explorer view as well as be ignored by intellisense. As for the path mapping I was hoping it would resolve (for intellisense) some custom import statements in the project. – Karl Thunberg Commented May 8, 2017 at 17:57
Add a ment  | 

1 Answer 1

Reset to default 6

In my project i was using jsconfig.json file for accesss the file imports directly from the ./src directory from wherever i am trying to import.

My jsconfig.json looks like:

{
    "pilerOptions": {
        "baseUrl": "./src"
     },
     "include": [
         "src"
      ]
}

include:

If no include attribute is present, then this defaults to including all files in the containing directory and subdirectories. When a include attribute is specified, only those files are included

baseUrl:

This gives the base directory for the file import path

this is my project structure where i have used jsconfig.json

so if i need to import a function from src/util/auth_util.js inside src/ponent/Login/index.js

inside src/ponent/Login/index.js

src/ponent/Login/index.js :

import { userLogin } from 'util/auth_util.js'

import statement if jsconfig.json as mentioned above not used

src/ponent/Login/index.js :

import { userLogin } from '../../util/auth_util.js'

发布评论

评论列表(0)

  1. 暂无评论