Trouble using browserify and externalify in project

I’m trying to make it so my Meteor project can load NPM packages for React. When I try to start my project, I get a ton of errors (truncated for sanity’s sake):

Started MongoDB.
npm-container: updating npm dependencies -- classnames, externalify...
Errors prevented startup:

While building the application:
node_modules/externalify/node_modules/replace-require-functions/node_modules/detective/node_modules/escodegen/node_modules/esprima/bin/esparse.js:1:15: Unexpected token ILLEGAL
node_modules/externalify/node_modules/replace-require-functions/node_modules/detective/node_modules/escodegen/node_modules/esprima/bin/esvalidate.js:1:15: Unexpected token ILLEGAL
node_modules/externalify/node_modules/replace-require-functions/node_modules/detective/node_modules/escodegen/node_modules/source-map/test/run-tests.js:1:15: Unexpected token ILLEGAL
node_modules/externalify/node_modules/replace-require-functions/node_modules/detective/node_modules/acorn/src/loose/expression.js:1:15: Unexpected reserved word
node_modules/externalify/node_modules/replace-require-functions/node_modules/detective/node_modules/acorn/src/loose/index.js:32:1: Unexpected reserved word
node_modules/externalify/node_modules/replace-require-functions/node_modules/detective/node_modules/acorn/src/loose/parseutil.js:1:15: Unexpected reserved word

I’ve no idea what’s causing this to happen.


classNames = require('classnames');


  "transforms": {
    "externalify": {
      "global": true,
      "external": {
        "react": "Package['react-runtime'].React.require"

Bump! I bet @SkinnyGeek1010 will know… :grin:

Lol, well yes and no. I’m not sure why it’s doing that exactly but try deleting the npm cache and re-trying… ./packages/npm-container/.npm. This might clear it up.

I had an issue with class-names not working on modulus… it tried to install the dev-dependancy ‘benchmark’ which failed as it wasn’t in the npm repository… not sure why it was even installing them. I just pasted the function in like below :frowning:

If that fails just use this:

classNames = function classNames() {
  var classes = '';

  for (var i = 0; i < arguments.length; i++) {
    var arg = arguments[i];
    if (!arg) continue;

    var argType = typeof arg;

    if ('string' === argType || 'number' === argType) {
      classes += ' ' + arg;

    } else if (Array.isArray(arg)) {
      classes += ' ' + classNames.apply(null, arg);

    } else if ('object' === argType) {
      for (var key in arg) {
        if (arg.hasOwnProperty(key) && arg[key]) {
          classes += ' ' + key;

  return classes.substr(1);

Ha! I thought about just writing it myself, too. I kinda don’t like that they got rid of (or are getting rid of) React.addons.classSet. Oh well. Thanks, Adam.

Yep no prob… also I just copied and pasted out of his github so it’s the latest stable version… hacky but I was able to deploy right away lol.