componentjs / builder2.js

builder for component
50 stars 20 forks source link

rewrite requires correctly when ending in '.js' #54

Closed camshaft closed 10 years ago

camshaft commented 10 years ago

I'm not sure if this is the correct repo to open this issue but I'm running into a problem where I depend on a repo that ends in '.js' and the require doesn't get rewritten correctly.

example

component.json

{
  "name": "my-component",
  "scripts": ["index.js"],
  "dependencies": {
    "visionmedia/page.js": "1.3.7"
  }
}

index.js

var page = require('page');

When I go to build the component I get this output:

// build/build.js

/// snip require stuff

require.register("my-component", function (exports, module) {
var page = require("page");

});

require("my-component")

From my understanding it should look like this instead:

// build/build.js

/// snip require stuff

require.register("my-component", function (exports, module) {
var page = require("visionmedia~page.js@1.3.7");

});

require("my-component")

From what it looks like to me the builder is looking at the repo name instead of the name of the component

jonathanong commented 10 years ago

fixed in 1.1.5. i just had a bad test as noted in https://github.com/component/builder2.js/pull/53, so i had no idea what was going on :(

camshaft commented 10 years ago

awesome! thanks