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

webpack aliases doesn't work in a multi-folder workspace #1572

Closed
3 tasks done
yyyanghj opened this issue Nov 30, 2019 · 4 comments
Closed
3 tasks done

webpack aliases doesn't work in a multi-folder workspace #1572

yyyanghj opened this issue Nov 30, 2019 · 4 comments

Comments

@yyyanghj
Copy link

  • I have searched through existing issues
  • I have read through docs
  • I have read FAQ

Info

  • Platform: Windows 10
  • Vetur version: 0.22.6
  • VS Code version: 1.40.2(user setup)

Problem

In a workspace, if the vue project folder is not first place in this workspace, webpack aliases doesn't work, so go to definition can not work.

// jsconfig.json
{
  "include": [
    "./src/**/*"
  ],
  "exclude": [
    "node_modules",
    "dist"
  ],
  "compilerOptions": {
    "checkJs": true,
    "baseUrl": ".",
    "paths": {
      "@/*": [
        "./client/*"
      ]
    }
  }
}

Reproducible Case

  1. clone reproduction repo
  2. create a empty folder
  3. create a workspace A , add the reproduction, add the empty folder.
  4. create a workspace B , add the empty folder, add the reproduction.

Now, open Home.vue from workspace A , select Counter and go to definition works. But in workspace B, go to definition doesn't work.

微信图片编辑_20191130095226
微信图片编辑_20191130095328

Maybe jsconfig.json not work?

@vojvodics
Copy link

vojvodics commented Dec 4, 2019

Looks like we have the same problem.
In a workspace setup, vetur autocompletes from the first project jsconfig.json

My setup:

  • app project
    • jsconfig.json
  • ui lib
    • jsconfig.json

In ui lib in any *.vue file I get autocomplete like this: (which is a config from app project)
Screen Shot 2019-12-04 at 10 17 38 AM

However, this works normally for js files (presumably because because i did not configure vetur for js files so regular vscode path works for js files)
Screen Shot 2019-12-04 at 10 18 17 AM

@yyyanghj
Copy link
Author

yyyanghj commented Dec 6, 2019

Looks like we have the same problem.
In a workspace setup, vetur autocompletes from the first project jsconfig.json

My setup:

  • app project

    • jsconfig.json
  • ui lib

    • jsconfig.json

In ui lib in any *.vue file I get autocomplete like this: (which is a config from app project)
Screen Shot 2019-12-04 at 10 17 38 AM

However, this works normally for js files (presumably because because i did not configure vetur for js files so regular vscode path works for js files)
Screen Shot 2019-12-04 at 10 18 17 AM

Yep, the js files work well.

@yyyanghj
Copy link
Author

yyyanghj commented Dec 6, 2019

BTW, the ESLint extension for VSCode has a eslint.workingDirectories option to solve this similar issue.
microsoft/vscode-eslint

@octref
Copy link
Member

octref commented Feb 11, 2020

This is the same underlying issue as #815. Glad you found a temporary solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants