I'm used babel-plugin-module-resolver cannot resolve module in vscode.
viweei opened this issue · 4 comments
flow with babel-plugin-module-resolver is work well in shell,but plugin of flow-language-support in vscode cannot resolve module.
I were changed "@/store" to "./store", it does worked well.
here are config file of .babelrc and .flowconfig
.babelrc
{
"presets": ["@babel/preset-flow", "@babel/preset-env"],
"plugins": [
"@babel/plugin-transform-runtime",
[
"module-resolver",
{
"root": ["src"],
"extensions": [".js", ".jsx"],
"alias": {
"@": "./src"
}
}
]
]
}
.flowcofnig
[ignore]
[include]
[libs]
flow-typed/
[lints]
[options]
module.system.node.resolve_dirname=node_modules
module.system.node.resolve_dirname=src
[strict]
This a problem in your Flow configuration and not an issue in the VSCode extension. If you run (edit: didn't notice you already had run it).flow check
on the command line, I bet that doesn't work correctly either
In this case, you need something like
module.name_mapper='^@/\(.*\)$' -> '<PROJECT_ROOT>/src/\1'
in the flowconfig [options]
. See name_mapper in the options docs.
it looks like yarn flow ./src
should've checked all the files, since there's no lazy mode. so then my question is why the CLI missed it...
unless the squiggle in vscode is actually from the built-in typescript/javascript language support?