requirejs / almond

A minimal AMD API implementation for use after optimized builds
Other
2.42k stars 169 forks source link

fixed broken map config resolution #105

Closed cstickel closed 9 years ago

cstickel commented 9 years ago

While adjusting relative dependency names in normalize function the baseParts variable gets modified (last element gets removed). Later on baseParts are used again for checking the map config. But the code there expects the unmodified baseParts to find the correct configuration.

Example:

//main.js
require.config({
  map: {
    a: {
      b: 'c'
    }
  }
});

require(['a'], function() {});
//a.js
define(['./b'], function() {});
//c.js
define([], function() {});

Almond throws "Uncaught Error: a missing b". It works with RequireJS (also optimized), therefore this seems not to be the expected behavior. If './b' is changed to 'b' it's also working in Almond.

jrburke commented 9 years ago

Thank you very much for this fix! I did a small follow on commit to move the comment to match the new code location. I will be doing a quick pass through other almond issues but then want to release 0.3.1 with this fix later today.