导入heatmap.js&时出错带有RequireJS的heamap-leaflet.ja

时间:2015-01-20 23:09:54

标签: javascript requirejs

我有这个require-config文件: (配置中有更多的包....)

require.config({
    baseUrl: '/static',
    waitSeconds: 10,
    packages: [
    {
        name: 'leaflet', 
        location: './bower_components/leaflet-dist',
        main: 'leaflet'
    },
    {
        name: 'heatmap', 
        location: './bower_components/heatmap.js-amd/src',
        main: 'heatmap'
    },
    {
        name: 'heatmapleaflet', 
        location: './bower_components/heatmap.js-amd/src',
        main: 'heatmap-leaflet'
    }
    ]
});

当我尝试使用heatmap或heatmap-leaflet时,requireJS无法找到包并将它们显示为未定义。

require(['leaflet','heatmap','heatmapleaflet'],function(leaflet, heatmap, heatmapleaflet)
{
    console.log(leaflet); // Works
    console.log(heatmap); // undefined
    console.log(heatmapleaflet); //undefined
}

我尝试了不同的方法,没有结果。

有什么问题?

0 个答案:

没有答案