Search code examples
typescriptsystemjsjspmjquery-inputmask

Loading jquery.inputmask using Systemjs, Jspm and TypeScript


I am using TypeScript 2.0 with a Systemjs dependency loader. I am trying to use the jquery.inputmask plugin along with several other of that caliber. The problem is I can not find the correct way to import the plugin. I used jspm to install in hopes that the connections where correct. I am not sure if I am just importing it wrong or there is a setup issue. I have tried the following:

1 -- Doesnt work

meta: {
    "jquery.inputmask": {
        "format": "global",
        "deps": ["jquery"]
    }
}

2 -- Doesnt Work

meta: {
    "jspm_packages/npm/[email protected]/dist/": {
        globals: {
            "jquery": "jquery"
        }
    }
}

jspm made 2 Entries for it

"jquery.inputmask": "npm:[email protected]",

and

"npm:[email protected]": {
  "jquery": "npm:[email protected]",
  "process": "github:jspm/[email protected]"
},

Can anyone show me how to correct whatever the issues is?


Solution

  • Just in case anyone was wondering. It took me all night but i finally got it working with the following changes in my config.js file.

    packages: {
        'jquery.inputmask': {
            main: '/dist/inputmask/jquery.inputmask.js',
            // format: 'global',
            defaultExtension: 'js',
            map: {
                'jquery': 'npm:[email protected]/dist/jquery.js',
            },
            meta: {
                'jauery.inputmask': {
                    deps: ['jquery'],
                    exports: '$'
                }
            }
        }
    }
    

    I hope that helps to someone.