Viclib Viclib - 1 year ago 135
Javascript Question

Node.js browserify slow: isn't there a way to cache big libraries?

I'm creating a file that requires huge libraries such as jquery and three.js using browserify. The compiling process takes several seconds, probably because it's recompiling all the libs for each minor change I make. Is there a way to speed it up?

Answer Source

Have you tried using the --insert-globals, --ig, or --fast flags? (they're all the same thing)

The reason it's slow may be that it's scanning all of jquery and d3 for __dirname, __filename, process, and global references.


I just remembered: Browserify will take any pre-existing require functions and fall back to using that. more info here

This means you could build a bundle for your static libs, and then only rebuild the bundle for your app code on change.

This coupled with my pre-edit answer should make it a lot faster.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download