Permalink
Browse files

support: fix browserify

  • Loading branch information...
rauchg committed Mar 12, 2014
1 parent 236c440 commit 901353d0447da42cba3a555260b95c3c320ddb8d
Showing with 12 additions and 1 deletion.
  1. +12 −1 support/browserify.js
View
@@ -25,6 +25,17 @@ function build(fn){
opts.entries = [path];
var bundle = {};
bundle.standalone = 'io';
- bundle.insertGlobalVars = ['global'];
+ bundle.insertGlobalVars = { global: glob };
browserify(opts).bundle(bundle, fn);
}
+
+/**
+ * Populates `global`.
+ *
+ * @api private
+ */
+
+function glob(){
+ return 'typeof self !== "undefined" ? self : '
+ + 'typeof window !== "undefined" ? window : {}';
+}

7 comments on commit 901353d

@defunctzombie

This comment has been minimized.

Show comment Hide comment
@defunctzombie

defunctzombie Mar 12, 2014

Contributor

?

Contributor

defunctzombie replied Mar 12, 2014

?

@rase-

This comment has been minimized.

Show comment Hide comment
@rase-

rase- Mar 12, 2014

Contributor

@defunctzombie if we don't do weird shit, browserify will insist on putting stuff like Buffer in. :S

Contributor

rase- replied Mar 12, 2014

@defunctzombie if we don't do weird shit, browserify will insist on putting stuff like Buffer in. :S

@rase-

This comment has been minimized.

Show comment Hide comment
@rase-

rase- Mar 12, 2014

Contributor

@defunctzombie so basically we dug up the part from browserify that sets insertGlobalVariables in the command line tool, and did the same for our build.

Contributor

rase- replied Mar 12, 2014

@defunctzombie so basically we dug up the part from browserify that sets insertGlobalVariables in the command line tool, and did the same for our build.

@defunctzombie

This comment has been minimized.

Show comment Hide comment
@defunctzombie

defunctzombie Mar 12, 2014

Contributor

was the default browserify 'global' not adequate?

Contributor

defunctzombie replied Mar 12, 2014

was the default browserify 'global' not adequate?

@rase-

This comment has been minimized.

Show comment Hide comment
@rase-

rase- Mar 12, 2014

Contributor

The replaced option? Or whadda ya mean? That's the default global. It's just that you have to put it there yourself either like that, or from the insert globals module as far as I can tell by browsing through the code.

Contributor

rase- replied Mar 12, 2014

The replaced option? Or whadda ya mean? That's the default global. It's just that you have to put it there yourself either like that, or from the insert globals module as far as I can tell by browsing through the code.

@rauchg

This comment has been minimized.

Show comment Hide comment
@rauchg

rauchg Mar 12, 2014

Contributor
Contributor

rauchg replied Mar 12, 2014

@defunctzombie

This comment has been minimized.

Show comment Hide comment
@defunctzombie

defunctzombie Mar 12, 2014

Contributor

interesting. I really thought there was an option to force it not to insert anything but still allow the global variable

Contributor

defunctzombie replied Mar 12, 2014

interesting. I really thought there was an option to force it not to insert anything but still allow the global variable

Please sign in to comment.