JSPM

  • Created
  • Published
  • Downloads 32408
  • Score
    100M100P100Q146023F
  • License MIT

Shims non commonJS modules so they can be browserified.

Package Exports

  • browserify-shim

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (browserify-shim) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

browserify-shim build status

Shims non commonJS modules so they can be browserified.

var browserify = require('browserify')
  , shim = require('browserify-shim');

var bundled = browserify({ debug: true })
  .use(shim({ alias: 'jquery', path: './js/vendor/jquery.js', export: '$' }))
  .use(shim.addEntry('./js/entry.js'))
  .bundle();

fs.writeFileSync(builtFile, bundled);

Install

npm install browserify-shim

Features

  • allows non commonJS modules to be shimmed in order to be browserified by specifying an alias, the path to the file and the identifier under which the module attaches itself to the global window object
  • TODO: allows commonJS modules that are not residing in your node_modules to be loaded from a specific path

Limitations

  • in order for browserify-shim to work correctly, you must not use browserify's built in addEntry(..), but use(shim.addEntry(..)) instead (see example)

Examples