Difference between simple import statement and System.import in ES6 Module Loader

吃可爱长大的小学妹 提交于 2019-12-11 02:41:45

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/30909805/difference-between-simple-import-statement-and-system-import-in-es6-module-loade

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!