michaelgmcd / vscode-language-babel

VSCode syntax highlighting for today's JavaScript
https://marketplace.visualstudio.com/items?itemName=mgmcdermott.vscode-language-babel
MIT License
131 stars 17 forks source link

babel-plugin-module-resolver aliases not resolved #47

Closed Yzrsah closed 5 years ago

Yzrsah commented 5 years ago

I use babel-plugin-module-resolver

I typically use a .babelrc with something like:

    [ "module-resolver", {
        "root": [ "./" ],
        "alias": {
            "components": "./src/components",
        }
    }],

with import statements like:

import Button from "components/Button";

This does not work for import paths in VSCode. I can't cmd-click on an import to navigate to it, etc.

Can anyone recommend a solution for this?

Yzrsah commented 5 years ago

Resolved with jsconfig.json

{
    "compilerOptions": {
        "target": "esnext",
        "baseUrl": "./src",
        "paths": {
            "*": ["./*"],
        }
    },
    "exclude": [
        "node_modules"
    ]
}