Extra code found in the production build
See original GitHub issueBug report
What is the current behavior?
input: https://github.com/dgeibi/webpack-tree-shaking-bug/blob/master/src/App.js
extra useRef()
found in the production build
If the current behavior is a bug, please provide the steps to reproduce.
clone https://github.com/dgeibi/webpack-tree-shaking-bug
npm run build
output: dist/main.js
What is the expected behavior?
no extra useRef()
in the useEffect
’s callback
Other relevant information: webpack version: 4.46.0 and 5.33.2 Node.js version: 14.16.0 Operating System: macOS 11.2.3 Additional tools:
Issue Analytics
- State:
- Created 2 years ago
- Comments:10 (6 by maintainers)
Top Results From Across the Web
create-react-app is showing all my code in production, how to ...
It seems to be correct behaviour in create-react-app according to Issue #1632. Gaeron: This is expected. You can delete .map files from the ......
Read more >Creating a Production Build - Create React App
If you're using code splitting to split up your application, this will create additional chunks in the build/static folder as well.
Read more >Reactjs Build Production: Optimize Performance - CopyCat Blog
The production mode minifies your code, optimises assets, and produces lighter weight source maps. Also, the warning messages and other features ...
Read more >How to fix build failures with `create-react-app` in production
First solution (recommended) Look into your build logs, and find any warnings printed by your build command. Fixing those warnings will make ...
Read more >Optimizing Performance - React
Use the Production Build. If you're benchmarking or experiencing performance problems in your React apps, make sure you're testing with the minified production...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Fixed in
5.7.0
, please update deps (https://github.com/terser/terser/commits/master), let’s close, for webpack we have PR from dependabot@csvan thanks for point on this
Seems to be closed in Terser, but not sure if released
https://github.com/terser/terser/commit/84c1a314ed43fa3f367159c140175791b5d06b9c