问题
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