Skip to content

--bare needs to support module.parent so that node modules work correctly #976

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

Open
dominictarr opened this issue Nov 7, 2014 · 3 comments · May be fixed by browserify/browser-pack#47
Open

Comments

@dominictarr
Copy link
Contributor

I want to use browserify --bare to create executables for node cli tools. With a large project, such as npmd (or browserify!) there might be a megabyte of javascript over hundreds of .js files. Since require is sync, and every file this can make start up time a UX issue. However, I figure that bundling everything into one large js file will be very fast (only one disk seek, especially on spinning disks)

However, the problem is that browserify does not support !module.parent which is a common way of detecting whether a given module is main module being run.

@dominictarr
Copy link
Contributor Author

adding this would be a very simple change to the module loader, it might add 2 lines.

@mafintosh
Copy link
Collaborator

it should probably also disable the browserify core shims so that var fs = require('fs') will actually return core fs

@dominictarr
Copy link
Contributor Author

@mafintosh yes --bare already does that!

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

Successfully merging a pull request may close this issue.

2 participants