Search code examples
angularsystemjssystemjs-builder

Angular doesn't start using SystemJS bundle


I've been experimenting a strange behivour since two weeks ago.

I have thinking about and I have decided to make a repo and make tests in order to isolate the problem.

It's a simple repo extracted from angular/quickstart. I have added a gulp file to build a bundle and when I have tryed to load it, I get the same problem. The application not start.

This is the config of systemjs: https://github.com/tolemac/systemjs-test/blob/master/systemjs.config.js

This is the gulpfile to build the bundle: https://github.com/tolemac/systemjs-test/blob/master/gulpfile.js

And this is the repo: https://github.com/tolemac/systemjs-test

Instructions to reproduce:

mkdir systemjs-test
cd systemjs-test
git clone https://github.com/tolemac/systemjs-test.git .
npm install
gulp bundle
npm start

Solution

  • Well, I have been spend more and more time with it.

    I have learned a lot reading the source code of systemjs, systemjs-builder and the babel plugins used by the builder to identify the module loader code of loaded modules. All only for realize that the problem is that SystemJS don't identify the format of the bundle module... due to that, systemjs don't execute the loaded code... then the solution was to set the format of the bundle via configuration, this way:

    packages: {
      ...
      ...
      ...
      'bundles/vendor.js': {
        format: "system"
      }
    }
    

    Solved!