浏览代码

config.js to work pre- as well as post-require.js

Herbert Vojčík 10 年之前
父节点
当前提交
3a23a6d5e5
共有 1 个文件被更改,包括 4 次插入1 次删除
  1. 4 1
      external/amber-dev/lib/config.js

+ 4 - 1
external/amber-dev/lib/config.js

@@ -15,7 +15,10 @@ exports.writeConfig = function (searchDir, fileForConfig) {
         if (err) throw err;
         var text = "/* DO NOT EDIT! This file is generated. */\n" +
             "\n" +
-            "require.config(" + JSON.stringify(result, null, 2) + ");";
+            "var require;\n" +
+            "(function (config) {\n" +
+            "if (require) require.config(config); else require = config;\n" +
+            "})(" + JSON.stringify(result, null, 2) + ");";
         fs.writeFile(path.join(searchDir, fileForConfig), text, function (err) {
             if (err) throw err;
         });