Request for option to build a non-minified production build
See original GitHub issueIs this a bug report?
No. It’s a feature request that will help me debug a problem with my code.
Similar to issue #3403, I also want a non-minified build. The discussion on that issue seemed to stall when no use-case could be provided. I have what I believe to be a valid use-case.
I’m using the react-scroll
library and have things working perfectly in a development build (yarn run start
), however, in a production build (yarn run build
) scrolling takes place but not to the correct location. I’m quite certain that I’m doing something wrong rather than there being any issue in react-scroll
, but I don’t yet know what that wrong thing is.
As the development build works, I can’t use it to debug the issue. I can try to debug the issue in a production build, but the components in the React developer tools have annoyingly short names such as g
, h
and t
. I can work with that, but its annoying having to do so.
Source maps are working correctly, so I can set a breakpoint and see intelligible code. However, as a result of minification the variable names available in the console, don’t match those shown in the source map. For example, suppose I have a makeSection
function which is used in setting up react-scroll
and its output stored in a variable sections
. If I set a breakpoint after the variable sections
has been set, and try to run sections
in the console, I get an Uncaught ReferenceError
. This can be worked around, but it is annoying to need to do so.
I know that I can use the debugger to see what’s in the sections
variable, but sometimes it nice to be able to evaluate code in the console and see what happens. The minification makes this annoyingly awkward.
So the first use-case is to make debugging production code more pleasant. There is a more general point here too.
The bug I’m experiencing is caused by a difference between the development build and production build, but which step introduces it I don’t know. Perhaps it’s a difference in the webpack config; or a difference in babel plugins; or perhaps even as a result of minification itself.
Whilst they might all be unlikely, I’d like to be able to toggle each difference between a development build and a production build and see which ones reproduce the issue. This would likely give me a better insight into the issue or at least give me a better idea of where to start looking.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:2
- Comments:7 (4 by maintainers)
Top GitHub Comments
I’m also running into the same issue. I believe it should be possible to build without minification, especially for staging environments.
How often are you getting different behavior between development and production? I feel like this should be rare enough that branch -> eject -> disable minification -> debug is the right path.