broccoli-cjs-wrap
Wrap naked CommonJS modules in a define
wrapper for use in browser.
Installation
npm install --save-dev broccoli-cjs-wrap
Usage (Sample Brocfile.js)
var cjsWrap = ;var filterEs6Module = ;var pickFiles = ;var mergeTrees = ; module { // in conjunction with es6 module filter var tree = broccoli; // create a CJS version var cjsTree = ; var wrappedCjsTree = ; return ;};
To build:
$ broccoli build output
Options
namespace
- Namespace all your modules. ex: 'MyApp',MyApp/tracker
packageName
- Name of your package, goes after the namespace.main
- main entry point of the module. ex: 'index',MyApp/tracker/index.js
->MyApp/tracker
. You must pass apackageName
and/ornamespace
if you usemain
require
- Require function thatdefine
is attached to. Defaults tothis.require