I\'m struggling with using Browserify and document ready events. How do I craft a module that exports content only available after the document ready event has fired? How do I
Instead of listening for a ready event, you can put your browserify bundle in a deferred script tag:
This allows you to remove the ready wrapper completely since the bundle will not be executed until the DOM is loaded.
Unfortunately support of defer
is patchy, and I don't recommend it unless you don't have to support IE < 10. Consider this answer one for the future, as browser support for it grows.