VSCode Intellisense 不能完全处理 ES6 导入?

And*_*lis 0 intellisense ecmascript-6 visual-studio-code

我无法让 Intellisense 完全使用 ES6 导入。

执行以下操作可使/index.jsIntellisense 正常工作:

工作示例

但是,从/index.js中断 Intellisense执行以下操作:

破碎的例子

目录结构为:

| modules
|-- cars.js
|-- index.js
| index.js
| jsconfig.json
Run Code Online (Sandbox Code Playgroud)

每个文件的内容是:

模块/cars.js

export default {
  audi: 'R8',
  dodge: 'Durango',
};
Run Code Online (Sandbox Code Playgroud)

模块/index.js

import cars from './cars';

export default {
  cars,
};
Run Code Online (Sandbox Code Playgroud)

jsconfig.json

{
  "compilerOptions": {
    "target": "es6",
    "module": "commonjs"
  },
  "exclude": [
    "node_modules"
  ]
}
Run Code Online (Sandbox Code Playgroud)

Kev*_*nan 5

Cars 不是modules/index.js. 的默认导出modules/index.js是一个对象,然后包含cars. 为了得到你想要的,制作这个内容modules/index.js

export { default as cars } from './cars';
Run Code Online (Sandbox Code Playgroud)