serverless-runtime-babel icon indicating copy to clipboard operation
serverless-runtime-babel copied to clipboard

Excluded modules are not browserified, but they are removed from the node_modules directory

Open martinbooth opened this issue 8 years ago • 3 comments

Hi,

There is a module binary_parser which is a dependency of mongodb which doesn't seem to play nice with browserify (https://github.com/jaredallard/nexe/issues/192).

This is somewhat similar to the fact that the aws-sdk doesn't play nice with browserify, except (in this case) I can't rely on the module just being available on the server like the aws-sdk.

I'd like to exclude this module from going into the browserify bundle which I can do quite easily by listing it in the excludes array however the code which deletes all js/json from node_modules wipes away the module and therefore my code doesn't work.

I'm happy to submit a pull request (if you're happy to accept one) to support a scenario where modules can be excluded from browserify whilst retaining them in the node_modeuls directory but just want to check which direction to go with this.

Would you suggest an additional configuration of option to exclude files/directories from the js/json cleanup process at the end, or automatically exclude modules from being cleaned up which are in the excludes array?

Martin

martinbooth avatar Apr 20 '16 11:04 martinbooth

@martinbooth I'm having the same problem with binary_parser. Have you found a workaround?

plbrault avatar Apr 27 '16 15:04 plbrault

No workaround, but I created a pull request which addresses this. Just waiting on some feedback.

My solution was to add bson to the browserify exclude option, but I needed to modify this plugin so that modules excluded from browserify are not deleted from the generated zip, and instead, left in the node_modules directory

martinbooth avatar Apr 28 '16 02:04 martinbooth

@ac360 @minibikini Any update on this?

plbrault avatar May 30 '16 15:05 plbrault