0.1.0 • Published 9 years ago

externalify v0.1.0

Weekly downloads
28
License
MIT
Repository
github
Last release
9 years ago

externalify

Browserify transform that lets you require external modules from any function that follows the require API.

Much like the external option to Browserify, but lets you specify a custom name for the require function to avoid creating a global require symbol.

Using via JavaScript

var browserify = require('browserify');

// configure what we want to externalize
var externalifyConfig = { external: { jquery: '$', three: 'THREE' } };

browserify()
  .require(require.resolve('./main'), { entry: true })
  .transform('exposify', externalifyConfig)
  .bundle({ debug: true })
  .pipe(fs.createWriteStream(path.join(__dirname, 'bundle.js'), 'utf8'))

Using via Commandline

Use the Browserify transform option:

browserify --debug -t [ exposify --external [ --jquery=$ --three=THREE ] ] exposify main > bundle.js

Installation

npm install exposify

License

MIT