-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Generate sourcemap for production plugin builds #33718
Conversation
Size Change: +1.79 kB (0%) Total Size: 1.15 MB
ℹ️ View Unchanged
|
For the full picture, there is also the comment that needs to be included in every module that DevTools use. It has some tiny impact on the size of the scripts that are sent to users:
Packages published to npm are transpiled with Babel, so changes to the webpack config won't have any impact on them. The good news is that source maps were handled before, example: |
Gutenberg has the same setup for source maps as WordPress core at the moment: We would have to change it in both places. I don't know what's the reason that source maps are produced only in the development mode. |
IIRC core doesn't include source maps because they can be huge and thus increasing the package size (for new versions but also minor/security update packages). Also they aren't really useful for the average user. |
Would this be a case for enabling it in the plugin but not in core WordPress? Plugin users are by definition testing the "bleeding edge" features of Gutenberg, and therefore might have more use for the debug tools. Alternatively, I think publishing the sourcemaps somewhere, even if not included in the plugin .zip file, might work for our use case 🤔 |
I agree with that. If we think of plugin users as of beta testers, why not provide a legible error information to report? |
@noahtallen if we were to ship the source maps only in the Gutenberg plugin but not in WP core bundle, would this PR already get us there? Or would we need more changes to prevent automatic bundling? |
I unfortunately don't know anything about how Gutenberg is merged into core, so I'm not sure. :/ |
646ba70
to
98c4203
Compare
I'd love to circle back to this! I think the outstanding question is whether this will impact the merge of Gutenberg to core WordPress. Can anyone speak to that? (Maybe @noisysocks?) |
I don't think it would affect the merge process, no. Core gets the JavaScript from npm. We already publish sourcemaps to npm (example), which I believe Core ignores. |
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.
Looks good for me, thank you @noahtallen!
I believe this was removed from the API, and sourcemaps are still generated.
bfdd530
to
a8a4748
Compare
using @wordpress/scripts, I still don't get a sourcemap when running |
@kkmuffme I'm not sure these changes impact the behavior of |
Thanks, I know. It runs counter the idea of |
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
Description
We would like source maps in production builds, specifically after the plugin .zip is published. (Our primary goal is to upload source maps to assist with error reporting and debugging.) I don't think there are any downsides beyond plugin size, since sourcemaps are only loaded when browser devtools are open. Since Gutenberg is OSS, the main argument against (that I could find) of hiding the source doesn't really apply either :)
Closes #15732
Related:
How has this been tested?
Screenshots
n/a
Types of changes
Enhancement
Checklist:
*.native.js
files for terms that need renaming or removal).