From b6e03170990fa4e30b2f2f933e0fa140a97f5902 Mon Sep 17 00:00:00 2001 From: Dan Abramov Date: Sun, 18 Sep 2016 13:43:43 +0300 Subject: [PATCH] Provide empty Node mocks for fs, net, tls --- config/webpack.config.dev.js | 9 ++++++++- config/webpack.config.prod.js | 9 ++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/config/webpack.config.dev.js b/config/webpack.config.dev.js index a88409f2d05..cfc971e609e 100644 --- a/config/webpack.config.dev.js +++ b/config/webpack.config.dev.js @@ -203,5 +203,12 @@ module.exports = { // makes the discovery automatic so you don't have to restart. // See https://github.com/facebookincubator/create-react-app/issues/186 new WatchMissingNodeModulesPlugin(paths.appNodeModules) - ] + ], + // Some libraries import Node modules but don't use them in the browser. + // Tell Webpack to provide empty mocks for them so importing them works. + node: { + fs: 'empty', + net: 'empty', + tls: 'empty' + } }; diff --git a/config/webpack.config.prod.js b/config/webpack.config.prod.js index 552ded48551..ae5ef218fe5 100644 --- a/config/webpack.config.prod.js +++ b/config/webpack.config.prod.js @@ -238,5 +238,12 @@ module.exports = { }), // Note: this won't work without ExtractTextPlugin.extract(..) in `loaders`. new ExtractTextPlugin('static/css/[name].[contenthash:8].css') - ] + ], + // Some libraries import Node modules but don't use them in the browser. + // Tell Webpack to provide empty mocks for them so importing them works. + node: { + fs: 'empty', + net: 'empty', + tls: 'empty' + } };