Skip to content

Commit

Permalink
Add __DEV__ global variable in webpack environment
Browse files Browse the repository at this point in the history
This variable is provided by React Native JavaScript environment, and
required by react-native-render-html.
Reference: https://reactnative.dev/docs/javascript-environment
  • Loading branch information
jsamr committed Nov 28, 2020
1 parent 78bc5c1 commit 2649ecf
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
9 changes: 7 additions & 2 deletions config/webpack/webpack.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}),
],
});
5 changes: 5 additions & 0 deletions config/webpack/webpack.prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
})
],
});

0 comments on commit 2649ecf

Please sign in to comment.