Bladeren bron

Using map-magic instead of shim to add runtime deps.

This cannot be used to add load-time dependencies,
but it is ok for runtime dependencies.
Shim does not work fine with optimizer (nor in node,
according to requirejs docs).
Herbert Vojčík 10 jaren geleden
bovenliggende
commit
19847685ab
2 gewijzigde bestanden met toevoegingen van 20 en 12 verwijderingen
  1. 5 12
      local.amd.json
  2. 15 0
      support/IDE.private.js

+ 5 - 12
local.amd.json

@@ -1,18 +1,11 @@
 {
     "paths": {
         "amber-attic": "src",
-        "amber-attic/resources": "resources"
+        "amber-attic/resources": "resources",
+        "amber-attic/IDE.private": "support/IDE.private"
     },
-    "shim": {
-        "amber-attic/IDE": [
-            "codemirror/lib/codemirror",
-            "codemirror/mode/smalltalk/smalltalk",
-            "codemirror/addon/hint/show-hint",
-            "css!codemirror/theme/ambiance",
-            "css!codemirror/lib/codemirror",
-            "css!codemirror/addon/hint/show-hint",
-            "jquery-ui",
-            "css!./resources/amber"
-        ]
+    "map": {
+        "*": {"amber-attic/IDE": "amber-attic/IDE.private"},
+        "amber-attic/IDE.private":{"amber-attic/IDE": "amber-attic/IDE"}
     }
 }

+ 15 - 0
support/IDE.private.js

@@ -0,0 +1,15 @@
+// Loads runtime dependencies (needed at init-time)
+// of amber-attic/IDE.
+define([
+    "amber-attic/IDE",
+    "codemirror/lib/codemirror",
+    "codemirror/mode/smalltalk/smalltalk",
+    "codemirror/addon/hint/show-hint",
+    "css!codemirror/theme/ambiance",
+    "css!codemirror/lib/codemirror",
+    "css!codemirror/addon/hint/show-hint",
+    "jquery-ui",
+    "css!./resources/amber"
+], function (x) {
+    return x;
+});