2016-05-09 5 views
-1

Ich möchte ein Modul in der Require-Konfiguration erstellen, die nicht vorhanden ist, aber gibt es nur zum Laden von Abhängigkeiten. Zum Beispiel:Requirejs erstellen leeres Modul, um als Abhängigkeitslader zu dienen

window["requirejs"].config({ 
      paths: { 
       main : "/Scripts/" + "/main", 
       jquery : "/Scripts/" + "/jquery-2.1.3.min", 
       HiChartsWithExtensions : false,//what to put here??? 
       HighCharts : "/Scripts/" + "/HighCharts/highcharts", 
       HighChartsExporting : "/Scripts/" + "/HighCharts/modules/exporting", 
       HighChartsExportingCsv : "/Scripts/" + "/HighCharts/modules/export-csv", 
      } 
      , shim : { 
       main : { 
       deps : ["HiChartsWithExtensions"] 
       }, 
       HiChartsWithExtensions : { 
       deps : ["HighChartsExporting"] 
       }, 
       HighCharts: { 
       deps : ["jquery"], 
       exports: '$' 
       }, 
       "HighChartsExporting" : { 
       deps : ["HighCharts"] 
       }, 
       "HighChartsExportingCsv" : { 
       deps : ["HighChartsExporting"] 
       } 
      } 
}); 
window["require"](['main']); 

Wo Haupt auf HiChartsWithExtensions hängt aber requirejs versucht, eine js-Datei für sie zu laden. Ich möchte, dass HiChartsWithExtensions Abhängigkeiten lädt, ohne dass dieses Modul tatsächlich etwas zurückgibt.

Antwort

1

Für jetzt; die folgende Lösung half:

window["requirejs"].config({ 
      paths: { 
       main : "/Scripts/" + "/main", 
       jquery : "/Scripts/" + "/jquery-2.1.3.min", 
       HiChartsWithExtensions : "/Scripts/" + "/HighCharts/modules/export-csv", 
       //deepest dependency here (csv depends on exporting depends on highcharts) 
       HighCharts : "/Scripts/" + "/HighCharts/highcharts", 
       HighChartsExporting : "/Scripts/" + "/HighCharts/modules/exporting", 
       HighChartsData : "/Scripts/" + "/HighCharts/modules/data", 
       HighChartsDrilldown : "/Scripts/" + "/HighCharts/modules/drilldown" 
      } 
      , shim : { 
       main : { 
       deps : ["HiChartsWithExtensions"] 
       }, 
       HiChartsWithExtensions : { 
       deps : ["HighChartsExporting","HighChartsData","HighChartsDrilldown"] 
       }, 
       HighCharts: { 
       deps : ["jquery"], 
       exports: '$' 
       }, 
       "HighChartsExporting" : { 
       deps : ["HighCharts"] 
       }, 
       "HighChartsData" : { 
       deps : ["HighCharts"] 
       }, 
       "HighChartsDrilldown" : { 
       deps : ["HighCharts"] 
       } 
      } 
}); 
window["require"](['main']);