question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Request for option to build a non-minified production build

See original GitHub issue

Is 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:closed
  • Created 6 years ago
  • Reactions:2
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
Vadorequestcommented, Nov 21, 2017

I’m also running into the same issue. I believe it should be possible to build without minification, especially for staging environments.

1reaction
heyimalexcommented, Nov 17, 2017

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to build a production version of React without minification?
Now, if I run npm run build I get a minified version of everything in the build folder. If I, however, run npm...
Read more >
Reactjs Build Production: Optimize Performance - CopyCat Blog
In this article, we will be taking a deep dive into the Reactjs build production, deployment, and tips on optimising your app's performance....
Read more >
Optimizing Performance - React
If you're benchmarking or experiencing performance problems in your React apps, make sure you're testing with the minified production build.
Read more >
Bundling and Minification | Microsoft Learn
Bundling and minification are two techniques you can use in ASP.NET 4.5 to improve request load time. Bundling and minification improves ...
Read more >
BuildOptions - StealJS
Options used to configure the build process. ... stealtools.build(config, { minify: false }); ... NODE_ENV=production steal-tools build --no-envify.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found