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

Multiple bundles example does not work #933

Closed
ysimonson opened this issue Oct 3, 2014 · 5 comments
Closed

Multiple bundles example does not work #933

ysimonson opened this issue Oct 3, 2014 · 5 comments

Comments

@ysimonson
Copy link

I've been trying to build multiple bundles and have hit various roadblocks. Finally I whittled my example down to an almost-replica of what's on the README, but it's still erroring out.

Here my robot.js:

module.exports = function (s) { return s.toUpperCase() + '!' };

beep.js:

var robot = require('./robot.js');
console.log(robot('beep'));

boop.js:

var robot = require('./robot.js');
console.log(robot('boop'));

index.html:

<html>
    <head>
        <title>Hello World Browserify Example</title>
    </head>

    <body>
        <script src="/public/common.js"></script>
        <script src="/public/beep.js"></script>
    </body>
</html>

The build commands I run:

browserify -r ./robot > public/common.js
browserify -x ./robot.js beep.js > public/beep.js
browserify -x ./robot.js boop.js > public/boop.js

When I open index.html, I get this error from common.js: Uncaught Error: Cannot find module '/robot.js'

For reference this is my directory structure:

public/
    beep.js
    boop.js
    common.js
beep.js
boop.js
index.html
robot.js

And my browserify version:

$ browserify --version
5.12.1
@danielkcz
Copy link

Yeah, I run into same issues. Something is very broken since 5.0.0 where they started using internal numeric ID instead of hashes and names.

@danielkcz
Copy link

I wrote more elaborate question to StackOverflow... http://stackoverflow.com/questions/26258423/how-to-create-vendor-bundles-with-latest-browserify-6-x-x

@ysimonson
Copy link
Author

Seems like there's a lot of dupe issues on this, as it's manifesting in various ways - #951, #939, #938, #935, #839, #850. Maybe others as well?

@Gijsjan
Copy link

Gijsjan commented Oct 24, 2014

Last version that works for me is ^3.26.0.

@ghost
Copy link

ghost commented Oct 25, 2014

Should be all fixed now in 6.1.2 and I added a test to the suite. The only thing is that now instead of:

browserify -r ./robot > public/common.js
browserify -x ./robot.js beep.js > public/beep.js
browserify -x ./robot.js boop.js > public/boop.js

you do:

browserify -r ./robot.js > public/common.js
browserify -x ./robot.js beep.js > public/beep.js
browserify -x ./robot.js boop.js > public/boop.js

This issue was closed.
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