From 2649ecff772bc118eb84afd3f355f37bdd9e14ca Mon Sep 17 00:00:00 2001 From: "Jules Sam. Randolph" Date: Sat, 28 Nov 2020 08:47:46 -0300 Subject: [PATCH] Add __DEV__ global variable in webpack environment This variable is provided by React Native JavaScript environment, and required by react-native-render-html. Reference: https://reactnative.dev/docs/javascript-environment --- config/webpack/webpack.dev.js | 9 +++++++-- config/webpack/webpack.prod.js | 5 +++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/config/webpack/webpack.dev.js b/config/webpack/webpack.dev.js index 871b46e53e55..4f6e0bd32fe9 100644 --- a/config/webpack/webpack.dev.js +++ b/config/webpack/webpack.dev.js @@ -16,6 +16,11 @@ module.exports = merge(common, { plugins: [ new webpack.DefinePlugin({ __REACT_WEB_CONFIG__: JSON.stringify(env), - }) - ] + + // React Native JavaScript environment requires the global __DEV__ variable to be accessible. + // react-native-render-html uses variable to log exclusively during development. + // See https://reactnative.dev/docs/javascript-environment + __DEV__: true, + }), + ], }); diff --git a/config/webpack/webpack.prod.js b/config/webpack/webpack.prod.js index 3a1604c44c3a..6cccd5242175 100644 --- a/config/webpack/webpack.prod.js +++ b/config/webpack/webpack.prod.js @@ -12,6 +12,11 @@ module.exports = merge(common, { plugins: [ new webpack.DefinePlugin({ __REACT_WEB_CONFIG__: JSON.stringify(env), + + // React Native JavaScript environment requires the global __DEV__ variable to be accessible. + // react-native-render-html uses variable to log exclusively during development. + // See https://reactnative.dev/docs/javascript-environment + __DEV__: false, }) ], });