goto-bus-stop / split-require

commonjs-first bundle splitting, for browserify
https://npmjs.com/package/split-require
MIT License
82 stars 8 forks source link

split-require and factor-bundle chicken/egg #40

Open emilbayes opened 4 years ago

emilbayes commented 4 years ago

Hi!

I'm a little confused by the combination of split-require and factor-bundle in tandem.

Is it possible for split-require to emit all files so they can be passed to factor-bundle ahead of time? Looking at the events it seems that split-require already leaves out dependencies from the main entry from the dynamic imports, but is it possible somehow to use factor bundle to take out all external dependencies?

In my test it seems factor.pipeline emits before split.pipeline, so I can't inject factor bundle later?

So my main entry file will contain a lot of shared dependencies, but a subset of my dynamic imports will also share dependencies. I'm trying to get a setup with hash based file naming so that all files are renamed to their hash and I can serve them with Cache-Control: Immutable, where npm dependencies will likely change very rarely, while my source files will sometimes change.