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

Broken build when requiring moment-timezone and moment #77

Open
d0b1010r opened this issue Oct 14, 2015 · 2 comments
Open

Broken build when requiring moment-timezone and moment #77

d0b1010r opened this issue Oct 14, 2015 · 2 comments

Comments

@d0b1010r
Copy link

factor-bundle creates broken bundles when required modules have linked dependencies. This happens for example when installing moment-timezone and afterwards moment. So moment exists two times in the node_modules folder, once for moment-timezone and once in moment. This seems to break browserify. When installing the modules the other way around the bundle does not break (this time there is only one moment).

I don't know if this is more of a problem with the way npm install modules when they have duplicate dependencies or if this is a problem with factor bundle.

I set up a test case over at: https://github.com/davidlanger/factor-bundle-moment-timezone

@terinjokes
Copy link
Contributor

@davidlanger Are your modules flattened with either npm dedupe or using npm@3?

@d0b1010r
Copy link
Author

Neither. npm -v returns 2.14.6 and nothing more than what I described. Test case quoted below (browserify and factor-bundle have to be available)

mkdir -p bundle

# remove the installed moment modules
rm -r node_modules/moment*
# install moment first, moment-timezone second
npm install moment@2.10.6
npm install moment-timezone@0.4.1
# bundle all the things!
browserify entry1.js entry2.js -p [ factor-bundle -o bundle/entry1.js -o bundle/entry2.js ] -o bundle/common.js
# test if the bundled stuff works
cat bundle/common.js bundle/entry1.js | node && echo "WORKS"
# works!


# remove the installed moment modules
rm -r node_modules/moment*
# install moment-timezone first, moment second
npm install moment-timezone@0.4.1
npm install moment@2.10.6
# bundle all the things!
browserify entry1.js entry2.js -p [ factor-bundle -o bundle/entry1.js -o bundle/entry2.js ] -o bundle/common.js
# test if the bundled stuff works
cat bundle/common.js bundle/entry1.js | node
# does not work!

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

No branches or pull requests

2 participants