更新时间:2022-11-02 19:36:48
模块加载器规范和导入/导出语法是分开的。所以这是模块加载器的属性(不是ES规范的一部分)。如果您使用支持诸如 SystemJS 的插件的模块加载程序。
Is it possible to import javascript module from external url in ES6?
I tried (using babel-node):
import mymodule from 'http://...mysite.../myscript.js';
// Error: Cannot find module 'http://...mysite.../myscript.js'
The module loader spec and the import/export syntax are separate. So this is a property of the module loader (not a part of the ES spec). If you use a module loader that supports plugins like SystemJS.