-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Scripts: Add official flags for build and start scripts #22310
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
Conversation
|
Size Change: 0 B Total Size: 834 kB ℹ️ View Unchanged
|
|
|
||
| - New `--webpack-no-externals` flag added to `build` and `start` scripts. It disables scripts' assets generation, and omits the list of default externals ([#22310](https://github.com/WordPress/gutenberg/pull/22310)). | ||
| - New `--webpack-bundle-analyzer` flag added to `build` and `start` scripts. It enables visualization for the size of webpack output files with an interactive zoomable treemap ([#22310](https://github.com/WordPress/gutenberg/pull/22310)). | ||
| - New `--webpack--devtool` flag added to `start` script. It controls how source maps are generated. See options at https://webpack.js.org/configuration/devtool/#devtool ([#22310](https://github.com/WordPress/gutenberg/pull/22310)). |
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.
Do we need wepack in the name or is it just an implementation detail?
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.
We need a way to filtering those flags. We did something similar for puppeteer. We could whitelist them to not pass to webpack (jest fails when you pass it unknown flag), too. I’m fine with renaming
sgomes
left a comment
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.
The changes regarding the bundle analyzer seem good, but I left a question/comment below.
|
Let's move forward with it. It was a long-standing issue. |
Description
Related to #21827.
Closes #14492.
This PR adds 3 new flags to use with
buildandstartscripts from@wordpress/scripts:--webpack-no-externalsflag added tobuildandstartscripts. It disables scripts' assets generation, and omits the list of default externals.--webpack-bundle-analyzerflag added tobuildandstartscripts. It enables visualization for the size of webpack output files with an interactive zoomable treemap.--webpack--devtoolflag added tostartscript. It controls how source maps are generated. See options at https://webpack.js.org/configuration/devtool/#devtool.WP_LIVE_RELOAD_PORTwasn't exposed as a flag because its future is uncertain. It might get replaces with React Fast Refresh as proposed in #21008.How has this been tested?
One way to test it by running
npm run analyze-bundlesin Gutenberg that was updated to use--webpack-bundle-analyzerflag.Types of changes
New features (non-breaking change which adds functionality).
Checklist: