简体   繁体   English

使用System.js,Jspm和TypeScript加载jquery.inputmask

[英]Loading jquery.inputmask using Systemjs, Jspm and TypeScript

I am using TypeScript 2.0 with a Systemjs dependency loader. 我将TypeScript 2.0与Systemjs依赖加载程序一起使用。 I am trying to use the jquery.inputmask plugin along with several other of that caliber. 我正在尝试将jquery.inputmask插件与其他几种口径一起使用。 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. 我用jspm进行安装,希望连接正确。 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 1-不起作用

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

2 -- Doesnt Work 2-不起作用

meta: {
    "jspm_packages/npm/jquery.inputmask@3.3.1/dist/": {
        globals: {
            "jquery": "jquery"
        }
    }
}

jspm made 2 Entries for it jspm为此做了2个条目

"jquery.inputmask": "npm:jquery.inputmask@3.3.1",

and

"npm:jquery.inputmask@3.3.1": {
  "jquery": "npm:jquery@2.2.4",
  "process": "github:jspm/nodelibs-process@0.1.2"
},

Can anyone show me how to correct whatever the issues is? 谁能告诉我如何解决所有问题?

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. 我花了一整夜的时间,但终于在config.js文件中进行了以下更改。

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

I hope that helps to someone. 我希望这对某人有帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM