Skip to content

Commit

Permalink
Guard aginst multiple binary includes
Browse files Browse the repository at this point in the history
npm can install fibers more than once which tends to lead to trouble.

Fixes #102, #177
  • Loading branch information
laverdet committed Jan 3, 2015
1 parent 68a8a85 commit d9bc3a7
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion fibers.js
@@ -1,3 +1,6 @@
if (process.fiberLib) {
return module.exports = process.fiberLib;
}
var fs = require('fs'), path = require('path');

// Seed random numbers [gh-82]
Expand All @@ -14,4 +17,4 @@ try {
}

// Pull in fibers implementation
module.exports = require(modPath).Fiber;
process.fiberLib = module.exports = require(modPath).Fiber;

1 comment on commit d9bc3a7

@imShara
Copy link

@imShara imShara commented on d9bc3a7 Jul 1, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WARNING in ./~/fibers/fibers.js
Module parse failed: ......../node_modules/fibers/fibers.js Line 2: Illegal return statement
You may need an appropriate loader to handle this file type.
| if (process.fiberLib) {
|   return module.exports = process.fiberLib;
| }
| var fs = require('fs'), path = require('path');

Please sign in to comment.