New bundling strategy makes it impossible to debug and apply patches
See original GitHub issueHi folks!
Congrats on the 4.0.0 release 🥳 🎈
We’ve been upgrading our codebase, and we’re coming across a handful of issues. We’ve managed to get to the bottom of most of them, but we’re no longer able to debug in the same way that we were able to previously.
I believe that this is result of two significant changes:
Issue 1
First, the React Admin output is minified.
In v3, the code was transpiled down from TS to JS,with little or no other code transformation being applied. Since v4 the code is also being minified, which causes a lot of problems with debugging.
No longer can we jump into our node_modules and run debuggers and logs to observe what’s happening with our code. It also means that it’s impossible to use tools like patch-package
to make any small bug fixes that may not be addressed until future versions of RA.
I believe that minification is an application-level concern, and library authors shouldn’t need to perform this step. It’s up to developers to decide on how they want to bundle their code for deployment. It makes a lot of sense to revert this change, though I’m also interested to hear what the benefits are of this new approach.
Issue 2
The other issue, which may have just been a little oversight is that we’re no longer able to click on an export to get directed to the source code, instead, it’s reverted to taking us to the types again.
I don’t think that I’ll be able to replicate this via a CodeSandbox, but I’ll whip up a before/after video
Before

After
Shows what the output of the ESM bundle looks like
Edit:
Removing --minify
from the build script prevents the output from being minified, which is good, but keeps the entire output contained in a single index.js
file. Are there code splitting concerns to be had with compiling the entire output into a single file?
Other information:
Environment
- React-admin version:
- Last version that did not exhibit the issue (if applicable):
- React version:
- Browser:
- Stack trace (in case of a JS error):
Issue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:6 (6 by maintainers)
FYI, the
src
directory is still included in the packages. Can’t you configure your bundler andpatch-package
to use it?Those are good points, thank you for reporting them. I’ll discuss with the team to see what we can do