Quantcast
Channel: Avoid bundling specific modules with Browserify - Stack Overflow
Viewing all articles
Browse latest Browse all 2

Avoid bundling specific modules with Browserify

$
0
0

I have a dependency tree like this:

index.js      \__ A      \__ B          \__ C          |   \__ D           \__ E

I want to bundle index.js and that works fine: browserify --node index.js -o bundle.js

The problem is when one of the dependencies has a dependency. Let's suppose it's D that has a native dependency (C++ code).

I want to install it manually using npm install D and make the bundle.js to really require it from the disk, not from the bundle.js code.

How can I exclude the D module from the bundle and make the bundle to require it from the node_modules?

I tried using --ignore D, but it returns an empty object when required.

How can I require a real module from the node_modules directory (the way like Node's require does?


Viewing all articles
Browse latest Browse all 2

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>
<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596344.js" async> </script>