jrburke/requirejs — Issue #200: Config paths not checked if id matches jsExtRegExp
Author: absoludity
Created: 2012-03-05 13:09:28+00:00
State: open

As per line:
https://github.com/jrburke/requirejs/blob/master/require.js#L1483

the require config is not even checked if the given id is something like 'expect.js'. Looking at the code, I don't see a reason why the order couldn't be changed here (ie. only check the jsExtRegExp if a path *isn't* defined in the config)?

Note: I'm only hitting this issue because I want to run my tests - which use expect.js - in both the browser and in node. The shim I'm using for expect.js in the browser (as expect.js isn't using amd) can't be used in node (at least, I can't find expect anywhere in the shim function when running from nodejs:

``` javascript
define(["expect_js_orig"], function() {
debugger
return window.expect;
});
```
as expect.js only exports itself if it detects module/export, which leaves me currently in the position that when running my tests via nodejs, I need to let nodejs' require load the module, which means I can't specify a path at all in my nodejs runner config, while in my browser config, need to specify a path for the id 'expect.js' which breaks as per #L1483 above. Or am I missing something obvious? (likely).

Thanks for the great work!