如何在ES2015 / babel中“导入”CDN库或非CommonJS库?

时间:2016-02-23 22:55:29

标签: requirejs ecmascript-6 babeljs

前我用AMD + require.js编写了html5项目。 在这种环境中,如果我想在cdn上加载远程库或加载非AMD库,请将它们添加到config.js并使用paths / shim属性。 像

require.config({
    baseUrl: "js",
    paths: {
        "jquery" : "//code.jquery.com/jquery-1.11.2.min",
        "jui" : "//code.jquery.com/ui/1.10.3/jquery-ui.min"
    },
    shim: {
        'jquery' : {
            exports: '$'
        },
        'jui' : { 
            deps: ['jquery'] 
        }
    }
});

现在我尝试使用Babel(ES2015)+ webpack + gulp切换。 我理解如何在本地服务器中加载CommonJS库,但是如何在这种环境下使用远程CDN中的非CommonJS库或库?

0 个答案:

没有答案