question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Bundle synchronously

See original GitHub issue

I need to call b.bundle() and get the entire output synchronously. How do I do this?

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
goto-bus-stopcommented, Sep 18, 2018

with async functions in JS you can do something like:

var promisify = require('util').promisify

async function build () {
  var b = browserify(...)
  var doBundle = promisify(b.bundle.bind(b))
  var buf = await doBundle()
  console.log(buf)
}

if you use some generator promise thing like co you can do the same with generators. note that that still bundles asynchronously, so doing it that way is quite nice!

3reactions
ferosscommented, Dec 16, 2014

You should probably change your code to use a callback.

But, if you really really need to it to be synchronous, you can try calling out to the browserify command line program using child_process.execSync in node 0.11. You can use exec-sync if you need to support 0.10 too.

Read more comments on GitHub >

github_iconTop Results From Across the Web

org.osgi.framework Interface SynchronousBundleListener
Unlike normal BundleListener objects, SynchronousBundleListener s are synchronously called during bundle lifecycle processing. The bundle lifecycle processing ...
Read more >
Bundled Server Messages | SuperCollider 3.12.2 Help
This allows you to open a bundle into which all osc messages will be collected ... now pass b as a pre-existing bundle,...
Read more >
How to load assets synchronously in addressable asset system.
I would suggest using AssetBundle.LoadAsync. if some day addressable become truly production ready, it's easier to migrate. As for those thing ...
Read more >
LazyMotion | Framer for Developers
The LazyMotion component can help you reduce bundle size by synchronously or asynchronously loading some, or all, of the motion component's features.
Read more >
How to do a synchronous require of Webpack build module ...
But it won't matter because outside the bundle, we will have a way to require Webpack modules. <script src="../dist/suman.js"></script> ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found