Our team develops browser side javascript
app. We use angularjs
as framework and some helper libraries in global namespace. For example: underscore
.
We carried out a large piece of code (input/output data tranformation) into a standalone library for unit testing reasons.
Now i try to use browserify
with this library. The question is about what the best way to exclude from bundle shared (with main app) dependences (underscore for example).
I tried 2:
- Using --external. I have to create bundle from underscore and use it for all code stuff in app. If i understood right this way seems inconvenient.
Using
browser
property in package.json to replace underscore with stub:module.exports = _;
I believe that there is more clean approach, but where is it?