Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Make sure plugins get a good relative parent name to use for require …

…calls.
  • Loading branch information...
commit b8cbb4f94fc7201bed172145aa6f759c1b7f8444 1 parent 055e0c5
James Burke authored

Showing 2 changed files with 7 additions and 2 deletions. Show diff stats Hide diff stats

  1. 8  require.js
  2. 1  tasks.txt
8  require.js
@@ -228,6 +228,7 @@ var require, define;
228 228
             return {
229 229
                 prefix: prefix,
230 230
                 name: name,
  231
+                parentName: baseName,
231 232
                 fullName: prefix ? prefix + "!" + name : name
232 233
             };
233 234
         }
@@ -475,7 +476,7 @@ var require, define;
475 476
                 //value as a dependency.
476 477
                 if (depArg) {
477 478
                     //Split the dependency name into plugin and name parts
478  
-                    depArg = splitPrefix(depArg, name);
  479
+                    depArg = splitPrefix(depArg, (name || relModuleName));
479 480
                     depName = depArg.fullName;
480 481
 
481 482
                     //Fix the name in depArray to be just the name, since
@@ -669,7 +670,10 @@ var require, define;
669 670
                 loaded[fullName] = false;
670 671
             }
671 672
 
672  
-            plugins[pluginName].load(name, makeRequire(name), function (ret) {
  673
+            //Use parentName here since the plugin's name is not reliable,
  674
+            //could be some weird string with no path that actually wants to
  675
+            //reference the parentName's path.
  676
+            plugins[pluginName].load(name, makeRequire(dep.parentName), function (ret) {
673 677
                 //Allow the build process to register plugin-loaded dependencies.
674 678
                 if (require.onPluginLoad) {
675 679
                     require.onPluginLoad(context, pluginName, name, ret);
1  tasks.txt
... ...
@@ -1,5 +1,6 @@
1 1
 - require.js + modules in one file, still asks to load the other files, if there is a require in there?
2 2
 - ending slash in paths should throw error: https://github.com/jrburke/requirejs/issues/issue/49/
  3
+- download page missing link to optimization tool.
3 4
 
4 5
 - sync calls to plugins, the has! example.
5 6
 

0 notes on commit b8cbb4f

Please sign in to comment.
Something went wrong with that request. Please try again.