Skip to content

Commit

Permalink
disable react and redux dev tools extensions in production
Browse files Browse the repository at this point in the history
  • Loading branch information
mattdelsordo committed Nov 9, 2023
1 parent 88bf437 commit c54f8d9
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 5 deletions.
5 changes: 4 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
{
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true
"editor.formatOnSave": true,
"[html]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
}
}
1 change: 1 addition & 0 deletions frontend/front/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
build/
3 changes: 2 additions & 1 deletion frontend/front/.prettierignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
.vscode
.vscode
build/
2 changes: 2 additions & 0 deletions frontend/front/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"dependencies": {
"@emotion/react": "^11.10.0",
"@emotion/styled": "^11.10.0",
"@fvilers/disable-react-devtools": "^1.3.0",
"@mui/icons-material": "^5.8.4",
"@mui/lab": "^5.0.0-alpha.103",
"@mui/material": "^5.10.9",
Expand Down Expand Up @@ -35,6 +36,7 @@
"scripts": {
"start": "PORT=3001 react-scripts start",
"build": "react-scripts build",
"serve": "npx serve build -l 3001",
"test": "react-scripts test",
"test-style": "run-s lint prettier",
"eject": "react-scripts eject",
Expand Down
5 changes: 5 additions & 0 deletions frontend/front/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ import App from "./App";
import reportWebVitals from "./reportWebVitals";
import { store } from "./redux/store";
import { Provider } from "react-redux";
import { disableReactDevTools } from "@fvilers/disable-react-devtools";

if (process.env.NODE_ENV === "production") {
disableReactDevTools();
}

const root = ReactDOM.createRoot(document.getElementById("root"));
root.render(
Expand Down
4 changes: 1 addition & 3 deletions frontend/front/src/redux/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,8 @@ export const createStore = (options) =>
// adding the api middleware enables caching, invalidation, polling and other features of `rtk-query`
middleware: (getDefaultMiddleware) =>
getDefaultMiddleware().concat(apiSlice.middleware),
devTools: process.env.NODE_ENV !== "production",
...options,
});

// Assign the Redux store to a global property 'window.store'
window.store = createStore();

export const store = createStore();
5 changes: 5 additions & 0 deletions frontend/front/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1428,6 +1428,11 @@
version "1.5.0"
resolved "https://registry.yarnpkg.com/@floating-ui/core/-/core-1.5.0.tgz#5c05c60d5ae2d05101c3021c1a2a350ddc027f8c"
integrity sha512-kK1h4m36DQ0UHGj5Ah4db7R0rHemTqqO0QLvUqi1/mUUp3LuAWbWxdxSIf/XsnH9VS6rRVPLJCncjRzUvyCLXg==
"@fvilers/disable-react-devtools@^1.3.0":
version "1.3.0"
resolved "https://registry.yarnpkg.com/@fvilers/disable-react-devtools/-/disable-react-devtools-1.3.0.tgz#d4f9cb23e955351765788cba363f87d88febc843"
integrity sha512-LbASP6voPkKS5b6OlQhupEDtMeoAakamauqLEFHatkQUTmblNY5nPK7/eSqKBXxExT6uypVPczpTsJjJIrhpOQ==

dependencies:
"@floating-ui/utils" "^0.1.3"

Expand Down

0 comments on commit c54f8d9

Please sign in to comment.