browserify / factor-bundle

factor browser-pack bundles into common shared bundles
Other
400 stars 27 forks source link

Flag to automatically divert absolute requires to common bundle #6

Closed edrex closed 10 years ago

edrex commented 10 years ago

Use case: Rapidly iterating on a deployed app, the app developer would like to avoid re-sending exernal dependencies on each app code change, since bundles are often multiple megabytes.

Flag would allow developers to use factor bundle in a single or multi entry-point configuration to automatically externalize absolute requires into common.js.

This feature seems in line with factor-bundle's other uses.

ghost commented 10 years ago

This use-case seems a bit too specific to bake into factor-bundle itself since what people consider "external dependencies" is going to vary a lot, but I'm open to having a generalized way of providing a bundle policy to decide which files should go into the common bundle. A good place to implement this policy logic would be the opts.threshold, which is currently just a number. If factor-bundle could take an opts.threshold that was a function, it would be easy to implement these kinds of custom factoring policies.

edrex commented 10 years ago

I like it. The change you describe would enable the use case I described above, among others. I am willing to take a crack at a PR if you're not already working on it.

ghost commented 10 years ago

closing since the now-documented opts.threshold(row) covers this use-case