-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Scripts: Builds should include source maps by default #45251
base: trunk
Are you sure you want to change the base?
Scripts: Builds should include source maps by default #45251
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with this change, but we should get more approvals and a rebase before merging
There is no reason production builds should not include sourcemaps by default - without sourcemaps, debugging the error or - for users - reporting errors is not possible, making the website and the web in general less accessible * analogous to WordPress#33718 * Fix: WordPress#44278 * Fix: WordPress#41551
ee8dff4
to
dc8572a
Compare
Rebased |
@noahtallen and @kkmuffme, there is also #46812 opened that takes a slightly different approach. As far as I understand, the other one keeps the old behavior by default but lets folks customize the setting when necessary, like in this PR. The alternative seems like a safer bet, but I would like to hear from you both what do you prefer. |
@gziolo we discussed & concluded somewhere (it's been too long, so I'd have to search it) that it's better to enable sourcemaps by default, since they make the web more accessible and are required so end users can report errors too |
I tend to agree with @kkmuffme, but I do think this would be a breaking change for |
#46812 definitely feels like a safer bet. Here, we need to assess for some scenarios:
|
Can you clarify what you mean, bc I am not sure I understand it.
Since there is not a single benchmark to be found about how much sourcemaps slow down a build, this isn't a concern for anyone.
They can't. This already is an issue now, if you look at some plugins on woocommerce.com, where the source files + maps are missing (e.g. .coffee, .ts,...) but you get them on request (= makes WP less accessible). An even bigger issue though are popular plugins that do this, where the devs do not provide the source files (and/or maps) at all, e.g. wpml,... These become non-extendable and, should they not be developed anymore, not usable/updateable anymore. In any way though, you can use DEVTOOL with value |
What?
gutenberg builds should include source maps by default
Why?
There is no reason production builds should not include sourcemaps - without sourcemaps, debugging the error or - for users - reporting errors is not possible, making the website and the web in general less accessible
How?
Making the WP_DEVTOOL not conditional on
isProduction
Sourcemaps can still be disabled, by explicitly setting
WP_DEVTOOL
tonone
Testing Instructions
npm run build
to create the bundled js, which will now include a .map file