How can I remove some developer component from the production build without ejecting? #12416
Answered
by
Dominick-Peluso-Bose
Dominick-Peluso-Bose
asked this question in
Q&A
|
Hi all, In my react app, I have some pages that I enable in the router with an environmental variable. Those pages have components that are only used for debugging by developers. When I create a production build, I'd really like it if I could remove those components from the build so they aren't included in the codebase. Is that possible without ejecting? I was thinking I'd have to customize webpack to do this but I'm not sure. |
Answered by
Dominick-Peluso-Bose
May 20, 2022
Replies: 1 comment
|
Using source-map-explorer I found that the components I was worried about already were excluded from the production build. I was using an environment variable to exclude them from the react-router-dom Switch block, so CRA/webpack must be configured to drop any import that isn't used. |
0 replies
Answer selected by
Dominick-Peluso-Bose
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Using source-map-explorer I found that the components I was worried about already were excluded from the production build. I was using an environment variable to exclude them from the react-router-dom Switch block, so CRA/webpack must be configured to drop any import that isn't used.