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

Capture prototype #20

Open goto-bus-stop opened 6 years ago

goto-bus-stop commented 6 years ago

Supposed to look like:

splitRequire.capture(function (ondone) {
  ssr.render(state, ondone)
}, function (err, result, bundles) {
  // bundles is array of splitRequire()'d entry points
})
// or
var { bundles, result } = await splitRequire.capture(async function () {
  return await ssr.render(state)
})
diffcunha commented 6 years ago

Very interesting

goto-bus-stop commented 6 years ago

we probably need some sort of manifest file to relate the file path on disk to the dynamic bundle too

diffcunha commented 6 years ago

That makes sense, I also made that with choo-bundles, where the browserify plugin is heavily inspired in split-require. Unfortunately I needed more than the manifest so I couldn’t just extend split-require. Nevertheless I have some code to handle that there https://github.com/nearform/choo-bundles