Skip to content
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

VSC shows error: File is not found in 'rootDir', Virtual script missing ... allowJS ... #2

Open
wz5899 opened this issue Dec 11, 2021 · 1 comment

Comments

@wz5899
Copy link

wz5899 commented Dec 11, 2021

First of all, this is a nice project using vue3 and feathers!

I found a minor issue when loading this project into Visual Studio Code:

When any vue or js file in 'client' folder is opened in VSC editor, VSC shows an errors under tsconfig.json: File not found in 'rootDir' and other error messages 'Virtual script missing ... allowJS ...' under that opened vue or js script.

This issue does not block the server or the client from running. But it is annoying in code review. I believe that this is caused by 'client' folder sitting outside of 'src' folder and the client scripts are in Javascript vs Typescript for the server scripts.

Adding a jsconfig.json file directly under 'client' folder will fix this. Here is the jsconfig.json I used (no errors after adding this file):

{
  "compilerOptions": {
    "baseUrl": ".",
    "paths": {
      "src/*": [
        "src/*"
      ],
      "app/*": [
        "*"
      ],
      "components/*": [
        "src/components/*"
      ],
      "views/*": [
        "src/views/*"
      ],
      "assets/*": [
        "src/assets/*"
      ],
      "vue$": [
        "node_modules/vue/dist/vue.runtime.esm-bundler.js"
      ]
    }
  },
  "exclude": [
    "build",
    "node_modules"
  ]
}
@wz5899
Copy link
Author

wz5899 commented Dec 11, 2021

Just did more testing. Adding the jsconfig.json file only removes the error messages of 'allowJS'. To get rid of File not found in 'rootDir', add 'client' in 'exclude' section in tsconfig.json.

  "exclude": [
    "client",
    "test"
  ]

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

No branches or pull requests

1 participant