ESP32
ESP32

Reputation: 8723

Is it possible to combine SYSTEMJS with REQUIREJS?

I'd like to attach my app to an existing portal app which uses REQUIREJS as amd loader. I would extend this app, but I would like to go for SYSTEMJS's loader with my part. It doesn't seem to be possible to use modules in the systemjs context, which were loaded with requirejs.

I have prepared a plunkr example for my problem:

  requirejs(['AlternateCase.js'], function(AlternateCase) {
    console.log(AlternateCase);
    System.import("app.js");
  });

https://plnkr.co/edit/nRnnHzRLyTJCT826WBo4

AlternateCase is an angular filter which I load with requirejs - the app I load using systemjs. I get the filter object (console.log) but I get "unknown provider" in my app for the filter.

The challenge is that the code of the filter must not be changed, because it represents the exsting app which I want to load but which I cannot change.

Upvotes: 0

Views: 701

Answers (1)

ESP32
ESP32

Reputation: 8723

I have been able to create a Plunker which works. https://plnkr.co/edit/a3ZMek8aUmBuusoIFBjE?p=preview

I have also accomplished to alternatively use system.js for AMD loading by overwriting requirejs with System.amdRequire.

window.requirejs = System.amdRequire;

However, requirejs + systemjs combines well too.

Upvotes: 1

Related Questions