connect-browserify
Connect/express middleware for serving apps to a browser with browserify
Last updated 3 years ago by andreypopp .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install connect-browserify 
SYNC missed versions from official npm registry.

Connect/express middelware for serving front-end applications with browserify. Install via npm:

npm install connect-browserify

Basic usage is as follows:

var express = require('express');
var browserify = require('connect-browserify');

app = express();
app.use('/js/app.js', browserify({
  entry: 'src/app.js',            // entry for your application

  requirements: ['src/views.js'], // additional modules to require, will
                                  // be exposed under id relative to
                                  // entry, e.g. './views' in current
                                  // example

  transforms: ['coffeeify'],        // transforms to use

  bundle: function(bundle) {      // optional, configure browserify instance
    // configure bundle
    return bundle
  },

  pipes: function(stream) {       // optional, apply post-bundle-transforms
    return stream                 // Receives the browserify bundle stream
      .pipe(uglifyStream);        // Must return another stream
  },

  onError: function(err) {        // optional, called if errors occur during the
    console.warn(err);            // build process. If not set, errors are only
  },                              // available via the middleware response

  contentType: 'text/javascript', // optional, Content-type header to use, by
                                  // default this equals to 'application/javascript'

  extensions: ['.js', '.coffee'], // to consider non-js files as
                                  // CommonJS modules

  debug: true                     // see browserify docs, other options are
}));

app.listen(3000);

This middleware will start watching directory of entry file for changes and rebuild bundle accordingly and caching the result for future requests.

You should never use this middleware in production — use nginx for serving pre-built bundles to a browser.

Current Tags

  • 5.0.0                                ...           latest (3 years ago)

31 Versions

  • 5.0.0                                ...           3 years ago
  • 4.0.0                                ...           5 years ago
  • 3.2.1                                ...           6 years ago
  • 3.2.0                                ...           6 years ago
  • 3.1.1                                ...           6 years ago
  • 3.1.0                                ...           6 years ago
  • 2.0.1                                ...           6 years ago
  • 2.0.0                                ...           6 years ago
  • 1.0.0                                ...           7 years ago
  • 0.7.0                                ...           7 years ago
  • 0.6.6                                ...           7 years ago
  • 0.6.5                                ...           7 years ago
  • 0.6.4                                ...           7 years ago
  • 0.6.3                                ...           7 years ago
  • 0.6.2                                ...           7 years ago
  • 0.6.1                                ...           7 years ago
  • 0.6.0                                ...           7 years ago
  • 0.5.2                                ...           7 years ago
  • 0.5.1                                ...           7 years ago
  • 0.5.0                                ...           7 years ago
  • 0.4.1                                ...           7 years ago
  • 0.4.0                                ...           7 years ago
  • 0.3.0                                ...           7 years ago
  • 0.2.3                                ...           7 years ago
  • 0.2.2                                ...           7 years ago
  • 0.2.1                                ...           7 years ago
  • 0.2.0                                ...           7 years ago
  • 0.1.3                                ...           7 years ago
  • 0.1.2                                ...           7 years ago
  • 0.1.1                                ...           7 years ago
  • 0.1.0                                ...           7 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 186
Dependencies (4)
Dev Dependencies (8)

Copyright 2014 - 2017 © taobao.org |