Reputation: 1495
vscode does not seems to support es6 import when used as a function to load dynamic chucks.
import is actually supported by webpack 2 + babel.
There are no issue with normal es6 imports or when using async functions.
Eslint was also reporting an error until I integrated babel-eslint.
I am using vscode version 1.9.1
I tried using a jsconfig.json but it did not change anything
{
// See http://go.microsoft.com/fwlink/?LinkId=759670
// for the documentation about the jsconfig.json format
"compilerOptions": {
"target": "es2017"
},
"exclude": [
"node_modules",
"bower_components",
"jspm_packages",
"tmp",
"temp"
]
}
Upvotes: 3
Views: 2269
Reputation: 2037
Dynamic imports are now supported by TypeScript (v2.4.x) and VSCode since June 2017 release (v1.14.x).
Upvotes: 0
Reputation: 1472
You can set "javascript.validate.enable": false
in the preferences and use another syntax validation (for example https://github.com/flowtype/flow-for-vscode).
Upvotes: 1
Reputation: 16089
I don't think dynamic imports are part of ES6, and they aren't supported by TypeScript yet (which drives the JS language service) so I think you'll have to use require
.
Upvotes: 1