bundling angular 2 + wijmo 5

Question!

I'm having troubles bundling an angular 2 app with wijmo components.

My gulp file has a specific task for the bundle action:

builder.buildStatic(‘app’, xxxx))

and my systemjs.config looks like:

var map = {
  'app': 'app',
  'rxjs': 'lib/rxjs',
  '@angular': 'lib/@angular',
  ***
  'wijmo': 'lib/wijmo'
};

var packages = {
  'app': { main: 'main.js', defaultExtension: 'js' },
  ***  
  'wijmo': { defaultExtension: 'js' }
};

With this configuration, bundling process fails saying:

[systemjs-builder] Bundling failed TypeError: Error compiling register module "lib/wijmo/wijmo.angular2.grid.js" at lib\wijmo\wijmo.angular2.grid.js Source lib\wijmo\wijmo.angular2.grid.js is already a bundle file, so can't be built as a module.

So I add:

var meta = {
  'wijmo/*': {
    format: 'register',
    build: false
  }
};

This makes finish successfuly the bundle bug running the app have an error:

if ("function" == typeof define && define.amd)
    define(["wijmo/wijmo.angular2.grid.min.js", "wijmo/wijmo.angular2.input.min.js"], t);
else {
    if ("object" != typeof module || !module.exports || "function" != typeof require)
        throw new Error("Module must be loaded as AMD or CommonJS");
    module.exports = t(require("wijmo/wijmo.angular2.grid.min.js"), require("wijmo/wijmo.angular2.input.min.js"))
}

Any idea how to solve this?

Thanks in advance!!



This video can help you solving your question :)
By: admin