unscriptable/curl — Issue #39: Relative paths of plugins and passed to plugins don't work
Author: bryanforbes
Created: 2011-12-17 20:27:38+00:00
State: open

I have the following structure:

```
eventd/
|_ curl/
| |_ curl loader source
|_ test/
|_ foo.js
|_ plugin.js
|_ test.js
|_ test.html
```

The files look like the following:

foo.js

```javascript
define([], function(){
return {
foo: "bar"
};
});
```

plugin.js

```javascript
define([], function(){
return {
load: function(id, require, load){
require([id], load);
}
};
});
```

test.js

```javascript
define(["./plugin!./foo"], function(foo){
console.log(foo);

return foo;
});
```

test.html

```html

Test Page

```

When I load `test.html`, I get the following error:

```
GET http://projects.local/eventd/plugin.js 404 (Not Found)
curl.js:705 Uncaught Error: Syntax error or http error: .././plugin.js
```

It seems that curl doesn't accept a relative path to a plugin module, which makes it very hard to write a library. There seems to be another problem as well: if I change the reference from `./foo!` to `test/foo`, I get the following error:

```
GET http://projects.local/foo.js 404 (Not Found)
curl.js:705 Uncaught Error: Syntax error or http error: /foo.js
```

It looks like it's looking for the `foo` module at the root of the server. In fact, the `id` passed to `load` is `/foo`. Is this right?