Skip to content Skip to sidebar Skip to footer

How To Es6 Import (systemjs) After Some Code?

I want to import angular, instantiate the AngularJS module, and then import another file that requires that the Angular be already instantiated: import angular from 'angular'; var

Solution 1:

By design, all import statements should be available for static analysis so they must be on the top-level. See this answer for a relevant question.

If you want to load module in runtime, you should not use import for it. But you can do it with System.import instead

System.import('src/app.js').then(function() {
   // deal with app.js
});

Post a Comment for "How To Es6 Import (systemjs) After Some Code?"