Import SystemJS into an Ionic app

Hi,

I have an Ionic app and I want to load an external module dynamically, similar to what’s explained in this StackOverflow post. In the accepted answer they say I need to use SystemJS for that.

I’m trying to do it, but I don’t know how to import or use SystemJS into an Ionic app. First of all, I installed the library using npm:

npm install --save systemjs

And then I tried to import it using one of the following:

import { System } from 'systemjs';
import * as System from 'systemjs';

With any of those statements I get the following error:

Uncaught Error: Cannot find module "."
    at webpackMissingModule (system.src.js:3860)
    at new SystemJSLoader$1 (system.src.js:3860)
    at system.src.js:3981
    at Object.<anonymous> (system.src.js:3990)
    at Object.exports.byteLength (system.src.js:3991)
    at __webpack_require__ (bootstrap e9c80ba…:54)
    at Object.996 (app.component.ts:1)
    at __webpack_require__ (bootstrap e9c80ba…:54)
    at Object.648 (main.ts:23)
    at __webpack_require__ (bootstrap e9c80ba…:54)

I tried importing them into the App module, into a provider or into a component, but the result was the same.

How can I import and use SystemJS in my Ionic app?

Thank you!