Automattic / browserbuild

Write for node, compile for browser.
170 stars 16 forks source link

relative paths question #23

Open ericgj opened 11 years ago

ericgj commented 11 years ago

Apologies to ask this support question here, but I didn't see anywhere else to ask. I cannot get browserbuild to work as described in the README. I am sure it's something basic I'm missing.

If I have files b.js and hithere.js as described in the README (all, including the main, in a lib directory), and run browserbuild as described, the output I get looks like this:

// require functions wrapper
require.register("lib/b.js", function(module, exports, require, global){ ... });
require.register("lib/hithere.js", function(module, exports, require, global){ ... });
var exp = require('hithere');if ("undefined" != typeof module) module.exports = exp;else hithere = exp;

And I get an error trying to require('hithere'), since it was registered as 'lib/hithere.js'.

I thought perhaps the base path needed to be provided, e.g. browserbuild -m hithere -b lib ..., but that doesn't work either as it registers it as '/hithere.js' .

The only way I could get it to work is to run within the source dir, e.g. cd lib && browserbuild -m hithere ... .

What am I missing? Thanks in advance.

Eric

rauchg commented 11 years ago

Try a trailing slash in lib ?

On Sun, Jan 13, 2013 at 2:28 PM, Eric Gjertsen notifications@github.comwrote:

Apologies to ask this support question here, but I didn't see anywhere else to ask. I cannot get browserbuild to work as described in the README. I am sure it's something basic I'm missing.

If I have files b.js and hithere.js as described in the README (all, including the main, in a lib directory), and run browserbuild as described, the output I get looks like this:

// require functions wrapperrequire.register("lib/b.js", function(module, exports, require, global){ ... });require.register("lib/hithere.js", function(module, exports, require, global){ ... });var exp = require('hithere');if ("undefined" != typeof module) module.exports = exp;else hithere = exp;

And I get an error trying to require('hithere'), since it was registered as 'lib/hithere.js'.

I thought perhaps the base path needed to be provided, e.g. browserbuild -m hithere -b lib ..., but that doesn't work either as it registers it as '/hithere.js' .

The only way I could get it to work is to run within the source dir, e.g. cd lib && browserbuild -m hithere ... .

What am I missing? Thanks in advance.

Eric

— Reply to this email directly or view it on GitHubhttps://github.com/LearnBoost/browserbuild/issues/23.

Guillermo Rauch LearnBoost CTO http://devthought.com

ericgj commented 11 years ago

thanks, browserbuild -m hithere -b lib/ ... seems to work.

rauchg commented 11 years ago

BOOM!

On Sun, Jan 13, 2013 at 3:24 PM, Eric Gjertsen notifications@github.comwrote:

thanks, browserbuild -m hithere -b lib/ ... seems to work.

— Reply to this email directly or view it on GitHubhttps://github.com/LearnBoost/browserbuild/issues/23#issuecomment-12202546.

Guillermo Rauch LearnBoost CTO http://devthought.com