How to bundle angular 2 and wijmo 5 with requirejs

Posted by: vessel-beaus.0 on 20 December 2022, 9:25 pm EST

    • Post Options:
    • Link

    Posted 20 December 2022, 9:25 pm EST

    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!!

  • Posted 22 December 2022, 11:57 pm EST

    Hi,

    I appreciate your patience, actually, we are trying to create a sample to replicate your issue on our end. We’ll update you with a working sample with all your requirements as soon as possible.

    Regards

  • Posted 26 December 2022, 4:53 pm EST

    Hi,

    Sorry, for the delayed response, but we are unable to replicate the issue on our end. You can refer to the attached sample for bundling the angular app with wijmo controls - angularGulpApp.zip

    In case you still face any issues, please share a sample replicating your issue, on which we can investigate and assist you accordingly.

    Regards,

    ~ Vivek

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels