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

1.1k views Asked by At

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

There are 1 answers

1
Giordano On BEST ANSWER

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.