有谁知道VSCode为什么不识别导入的es6模块?是不是还没有完全实现,还是我没有正确设置?我无法通过他们的文档或搜索谷歌找到任何解决方案。
我在生成的jsconfig文件旁边的根目录中设置了一个typings文件夹。我试图摆弄设置,添加不同的"模块"编译器选项,仍然无法正常工作。
{
// See http://go.microsoft.com/fwlink/?LinkId=759670
// for the documentation about the jsconfig.json format
"compilerOptions": {
"target": "es6"
},
"exclude": [
"node_modules",
"bower_components",
"jspm_packages",
"tmp",
"temp"
]
}
当我使用import express from 'express'
时,它无法识别该模块,但当我使用import express = require('express')
时,它确实存在。
答案 0 :(得分:2)
您需要在"compilerOptions"
内添加以下内容:
"allowSyntheticDefaultImports": true