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

browserify transform #7

Open
benjamine opened this issue Sep 15, 2014 · 4 comments
Open

browserify transform #7

benjamine opened this issue Sep 15, 2014 · 4 comments

Comments

@benjamine
Copy link

I use browserify to bundle commonjs modules, browserify does this by detecting calls to require, so it won't work out-of-the-box with requireDir.
But this can be done by writing a plugin, aka "browserify transform" specific for require-dir, someone did it here https://www.npmjs.org/package/folderify for the analogous lib "includeFolder".
Is there any folderify equivalent for requireDir? any plans on having one?

@aseemk
Copy link
Owner

aseemk commented Jan 29, 2015

Sorry for the delay here, @benjamine!

Great feature request. I don't have much experience with browserify myself, so I probably won't get to this anytime soon, but I would love to support this work if I can.

@piranna
Copy link

piranna commented Aug 12, 2015

This should be mostly easy, just add a "browser" entry on the package.json pointing to a module that export an object with the same API as requireDir, but instead return the requires from an object filled during browserify stage instead of runtime. This last one would be the most difficult part.

@yocontra
Copy link
Collaborator

yocontra commented Feb 7, 2018

Is this a feature you're still interested in? I'd take a PR for it if it doesn't add too much surface and is done in a generic way.

@benjamine
Copy link
Author

benjamine commented Feb 7, 2018

sorry since this I moved away from requireDir and from browserify too, but others might find it useful,
since the time I reported this, cross-bundler (browserify/webpack/rollup) standards like what @piranna mentions appeared, so might make this simpler now, and perhaps doable with compatibility for all those bundlers, check https://github.com/defunctzombie/package-browser-field-spec

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

No branches or pull requests

4 participants