timarney / react-app-rewired

Override create-react-app webpack configs without ejecting
MIT License
9.81k stars 425 forks source link

How to prevent exucuting some code in app #490

Closed Profesor08 closed 3 years ago

Profesor08 commented 4 years ago

How to prevent exucuting some code in app, after I run build task? Can i somehow detect in app? I want to exucute some code only in real user browser, but not while build task is executed.

dawnmist commented 4 years ago

Code in the app IS only executed when the project is run in a browser. Code in the app does not get executed when being compiled.

The only code executed during build time that you write would be what you put in the config-overrides.js file when building with react-app-rewired as that file contains compiling instructions.