diff --git a/package.json b/package.json index 987347a1d..8e059c3fa 100644 --- a/package.json +++ b/package.json @@ -48,6 +48,7 @@ "chalk": "^1.0.0", "connect": "2.8.3", "debug": "~2.1.0", + "graceful-fs": "^3.0.6", "image-size": "0.3.5", "joi": "~5.1.0", "jstransform": "10.1.0", diff --git a/packager/react-packager/index.js b/packager/react-packager/index.js index 3a70659cf..a7b6264b7 100644 --- a/packager/react-packager/index.js +++ b/packager/react-packager/index.js @@ -8,6 +8,8 @@ */ 'use strict'; +useGracefulFs(); + var Activity = require('./src/Activity'); var Server = require('./src/Server'); @@ -45,3 +47,16 @@ exports.getDependencies = function(options, main) { return r.dependencies; }); }; + +function useGracefulFs() { + var fs = require('fs'); + var gracefulFs = require('graceful-fs'); + + // A bit sneaky but it's not straightforward to update all the + // modules we depend on. + Object.keys(fs).forEach(function(method) { + if (typeof fs[method] === 'function' && gracefulFs[method]) { + fs[method] = gracefulFs[method]; + } + }); +}