-
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: Add official flags for build and start scripts #22310
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
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
build
andstart
scripts from@wordpress/scripts
:--webpack-no-externals
flag added tobuild
andstart
scripts. It disables scripts' assets generation, and omits the list of default externals.--webpack-bundle-analyzer
flag added tobuild
andstart
scripts. It enables visualization for the size of webpack output files with an interactive zoomable treemap.--webpack--devtool
flag added tostart
script. It controls how source maps are generated. See options at https://webpack.js.org/configuration/devtool/#devtool.WP_LIVE_RELOAD_PORT
wasn'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-bundles
in Gutenberg that was updated to use--webpack-bundle-analyzer
flag.Types of changes
New features (non-breaking change which adds functionality).
Checklist: