Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

--require/-r seems to be broken when used with pipe input after browserify v4 #1019

Open
cymen opened this issue Dec 10, 2014 · 4 comments
Open

Comments

@cymen
Copy link
Contributor

cymen commented Dec 10, 2014

Here is a repo with branches browserify_4, _5, _6, _7 to demonstrate:

https://github.com/cymen/browserify-pipe-issue/

It looks like it is the require that is breaking. For browserify v4, it works:

https://github.com/cymen/browserify-pipe-issue/blob/browserify_4/built/common.js

But after v4, the require for ./robot.js used in browserifying common.js does this (does not work):

https://github.com/cymen/browserify-pipe-issue/blob/browserify_5/built/common.js
https://github.com/cymen/browserify-pipe-issue/blob/browserify_6/built/common.js
https://github.com/cymen/browserify-pipe-issue/blob/browserify_7/built/common.js

I have the build with pipes approach in the package.json which is:

{
  ...
  "scripts": {
    "build_common": "cd lib && cat common.js | browserify -r ./robot.js - > ../built/common.js",
    "build_beep": "cd lib && cat beep.js | browserify -x ./robot.js - > ../built/beep.js",
    "build_bop": "cd lib && cat bop.js | browserify -x ./robot.js - > ../built/bop.js",
    "build": "npm run build_common && npm run build_beep && npm run build_bop",
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  ...
}
@gabrielecirulli
Copy link

👍 Can anyone confirm this?

@gabrielecirulli
Copy link

Hello? 😛

@joshfrench
Copy link

I'm also seeing this on Browserify 8.

@joshfrench
Copy link

Scratch that, this appears to just be a path issue. The following works as expected, with common.js including the source of robot.js and beep.js only referencing it:

# lib/common.js
var robot = require('./lib/robot');
# lib/beep.js
var robot = require('./lib/robot');
$ browserify -r ./lib/robot.js -o built/common.js - < lib/common.js
$ browserify -x ./lib/robot.js -o built/beep.js - < lib/beep.js

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants