VSCode 无法识别具有 es6 语法的导入模块
VSCode not recognising imported modules with es6 syntax
有谁知道为什么 VSCode 不能识别导入的 es6 模块?它只是尚未完全实施还是我没有正确设置?我无法从他们的文档或搜索 google.
中找到任何解决方案
我在生成的 jsconfig 文件旁边的根目录中设置了一个 typings 文件夹。我试过摆弄设置,添加不同的 "module" 编译器选项,仍然不起作用。
{
// 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')
时它可以。
您的 "compilerOptions"
中需要以下内容:
"allowSyntheticDefaultImports": true
有谁知道为什么 VSCode 不能识别导入的 es6 模块?它只是尚未完全实施还是我没有正确设置?我无法从他们的文档或搜索 google.
中找到任何解决方案我在生成的 jsconfig 文件旁边的根目录中设置了一个 typings 文件夹。我试过摆弄设置,添加不同的 "module" 编译器选项,仍然不起作用。
{
// 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')
时它可以。
您的 "compilerOptions"
中需要以下内容:
"allowSyntheticDefaultImports": true