Skip to content

Commit

Permalink
Demonstrate how to replace __DEV__ with false in production builds (#51)
Browse files Browse the repository at this point in the history
  • Loading branch information
benjamn authored Jul 29, 2021
1 parent 000496b commit 3a071a0
Show file tree
Hide file tree
Showing 3 changed files with 90 additions and 1 deletion.
14 changes: 14 additions & 0 deletions config-overrides.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
const {
override,
addWebpackPlugin,
} = require("customize-cra");

const webpack = require("webpack");

module.exports = override(
addWebpackPlugin(
new webpack.DefinePlugin({
__DEV__: JSON.stringify(process.env.NODE_ENV !== "production"),
}),
),
);
73 changes: 73 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@
"react-dom": "^17.0.2"
},
"devDependencies": {
"customize-cra": "^1.0.0",
"react-app-rewired": "^2.1.8",
"react-scripts": "^4.0.3"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"build": "react-app-rewired build",
"test": "react-scripts test --env=jsdom"
},
"browserslist": [
Expand Down

0 comments on commit 3a071a0

Please sign in to comment.