我需要做类似的事情:
if (condition) {
import something from 'something';
}
// ...
if (something) {
something.doStuff();
}
Run Code Online (Sandbox Code Playgroud)
上面的代码没有编译; 它抛出SyntaxError: ... 'import' and 'export' may only appear at the top level
.
我试着用System.import
如图所示这里,但我不知道在哪里System
的来了.是不是最终被接受的ES6提案?该文章中"programmatic API"的链接将我转储到已弃用的文档页面.