promethify

Browserify plugin async load code like AMD

promethify

Browserify v2 transform to require AMD style and async fetch bundles with minimal configuration

scriptjs is a required dependency to use this transform. npm install --save scriptjs

 
//foo.js 
 
console.log(window.loaded) // undefined 
 
require(['/bar'], function(bar){
  console.log(bar.hello); // async fetch the bar bundle and log 'world' 
  console.log(window.loaded); // true 
});
 
//bar.js 
 
module.exports = {hello: 'world'};
window.loaded = true;
 
  "promethify": {
    "basedir": "test",
    "port": 8087
  }

Configuration is provided through the package.json of your project. There are two required properties.

  1. basedir This option is the path from the package.json of your project that you want to use for lookups when requiring files asynchronously.
  2. port This option is the port number that you want the server that asynchronously fetches the new bundles to bind to.