jrburke/requirejs — Issue #158: Module names are normalized twice
Author: richardhodgson
Created: 2012-01-02 22:29:50+00:00
State: open

Hi,

I have a project in the following structure:

```
2.js
a/
example.html
b/
1.js
3.js
```

`example.html` loads the `b/1` module. The `b/1` module depends on `2`, which itself depends on `b/3`.

With v1.0.3, this causes RequireJS to attempt to load the `b/3` module with and extra "../" in the url.

I think this is because in the module name is being `normalize`d twice in the `makeModuleMap` function. The result of the first normalization is passed an argument to `context.nameToUrl`, which also passes its `moduleName` argument to `normalize`.

Simply changing the value passed from `makeModuleMap` seems the most compatible way to fix the bug (`nameToUrl` is public api?).

My test case is at http://rhodgson.co.uk/bugs/requirejsbug.zip. Update the path to `require.js` in `example.html` and open in a web browser.

Richard.