ES6 Module Loader中简单导入语句和System.import之间的区别 [英] Difference between simple import statement and System.import in ES6 Module Loader

查看:1828
本文介绍了ES6 Module Loader中简单导入语句和System.import之间的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人可以解释ES6模块的简单 import System.import 语句之间的区别装载机(或Polyfills像System.js,Webpack等)



  System.import( 'https://code.jquery.com/jquery.js')。然后(); 

似乎是可能的,以及一个简单的

  import'jquery'; 

System.import 唯一的可能性在导入语句之后有回调?

解决方案

您可以使用< script> ; 不支持导入的标签,也可以有条件地加载模块。



所以你可以通过API以编程方式导入模块基于ES6承诺,除了用于使用ES6导入的模块的声明性语法。


Is anybody able to explain the difference between a simple import and a System.import statement of the ES6 Module Loader (or Polyfills like System.js, Webpack etc.)

Something like

System.import('https://code.jquery.com/jquery.js').then();

seems to be possible, as well as a simple

 import 'jquery';

Is System.import the only possibility to have a callback after the import statement?

解决方案

You can use the System.import inside <script> tags where import aren't supported, and you can also load modules conditionally.

So you can programmatically import a module, via an API based on ES6 promises, in addition of the declarative syntax for working with modules that is the ES6 import.

这篇关于ES6 Module Loader中简单导入语句和System.import之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆