-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Report dependencies externalized with Dependency Extraction Plugin #35106
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
|
👋 Thanks for your first Pull Request and for helping build the future of Gutenberg and WordPress, @tomalec! In case you missed it, we'd love to have you join us in our Slack community, where we hold regularly weekly meetings open to anyone to coordinate with each other. If you want to learn more about WordPress development in general, check out the Core Handbook full of helpful information. |
d18548b to
6aebe3d
Compare
|
Thank you for opening this Pull Request.
How people can access those articles? It's hard to understand how the changes proposed would benefit the WordPress project and the community without this context. The build process in Gutenberg and WordPress core replaces all WP dependencies with |
I created an issue in this repo #35630 This PR tries to address problem 5. stated there
That's exactly the DevX problem I'm trying to address here. Thanks to this PR a developer would at least know which of their local dependencies are extracted and which are not. So for which packages do they need to anticipate different versions. |
jsnajdr
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.
Works well for me 👍
What do I have to provide to enable this option? Can you share a full example? |
I tested this new option by modifying the |
|
Thinking a bit more about it, if you want to see a full list of externalized dependencies you can enable |
I added more elaborate steps to reproduce in the OP #35106 (comment) Is that clearer now? |
Interesting. I didn't think
I thought it is to change the behavior of generating assets separately for each entry point to generating a single file. So to change the way it actually exposes the assets to be used on runtime. Also, for new DependencyExtractionWebpackPlugin( {
combineAssets: false,
outputFormat: 'json',
} );it generates this list of internal identifiers {
"index.js": {
"dependencies": [
"lodash",
"moment",
"react",
"react-dom",
"wc-components",
"wc-navigation",
"wc-settings",
"wp-a11y",
"wp-api-fetch",
"wp-data",
"wp-data-controls",
"wp-date",
"wp-deprecated",
"wp-dom",
"wp-element",
"wp-hooks",
"wp-html-entities",
"wp-i18n",
"wp-is-shallow-equal",
"wp-keycodes",
"wp-polyfill",
"wp-priority-queue",
"wp-rich-text",
"wp-url",
"wp-warning"
],
// …instead of [
"@wordpress/i18n",
"@wordpress/hooks",
"@woocommerce/wc-admin-settings",
"@woocommerce/navigation",
"@wordpress/element",
"@woocommerce/components",
"@wordpress/data-controls",
"@wordpress/data",
"@wordpress/api-fetch",
"@babel/runtime/regenerator",
"@wordpress/url",
"@wordpress/date",
"lodash",
"moment",
"@wordpress/deprecated",
"@wordpress/a11y",
"@wordpress/html-entities",
"react",
"@wordpress/keycodes",
"@wordpress/priority-queue",
"react-dom",
"@wordpress/dom",
"@wordpress/is-shallow-equal",
"@wordpress/rich-text",
"@wordpress/warning"
]But that's pretty close, do you think we can somewhat merge those two together? |
Seems to me that the purposes of
|
|
@gziolo What's your take on the above comments? |
gziolo
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.
I think we should focus on bringing ES Modules and import maps to WordPress core to eventually make this plugin obsolete. It’s going to be a long process so if you think it’s helpful to add this feature then let’s land it.
|
One of the Continues Integration jobs fails even on subsequent re-tries: https://github.com/WordPress/gutenberg/runs/4261297083?check_suite_focus=true Can you check if rebasing with |
to report all dependencies extracted for the burrent build.
Use the default filename - `'externalized-dependencies.json'` for `true`. Addresses WordPress#35106 (review)
81b2d9b to
96523c3
Compare
Thanks, @gziolo . Rebased, everything is green now. |
Report externaized dependencies to `/.externalized.json`. Help to inspect how wide range of granular dependencies we need to cover. Use `trunk` version of `@wordpress/dependency-extraction-webpack-plugin` to be able to use unreleased WordPress/gutenberg#35106
Report externa;ized dependencies to `/.externalized.json`. Help to inspect how wide is the range of granular dependencies we need to anticipate. Use `trunk` version of `@wordpress/dependency-extraction-webpack-plugin` to be able to use unreleased WordPress/gutenberg#35106
|
@gziolo is there any date when this (and two other PRs) could be released to npm? - so it could be easily used outside |
We are in the process of releasing the next major WordPress version (5.9) so we don't do regular npm publishing every two weeks. I plan to run the development release with the |
|
Thank you for the info! BTW, I made a small improvement for this feature in #37377, maybe it could get into that release as well? |
|
It's now available for testing on npm with: The stable version should be available in the second half of January. |
|
Awesome, thanks for the heads-up :) |
Description
This PR adds a new option for plugin config
externalizedReportFile, to report all dependencies exported for the current project.I need it as I try to build a tool that helps to inspect, analyze and manage the versions being used for local unit tests, and that runs with WordPress.
To compare the versions used locally, with the versions used in the range of supported WP builds.
edit:
This PR tries to address problem 5. from #35630
Thanks to this PR a developer would at least know which of their local dependencies are extracted and which are not. So for which packages do they need to anticipate different versions.
How has this been tested?
I run this code against
https://github.com/woocommerce/google-listings-and-ads repo's webpack config with and without the new option.
node_modules/@wordpress/dependency-extraction-webpack-pluginwith the changed one from this PRpackages/dependency-extraction-webpack-plugin.Without the new option
npm run build/js/build/index.jsbundle is created as before.With the new option
reportExternalizedoption to the/webpack.config.js#L79-L83:npm run build/js/build/index.jsbundle is created as before./js/build/externalized.jsis created and contains:Screenshots
Types of changes
New feature (non-breaking change which adds functionality)
Checklist:
npm installfor entire repo fails on my machine*.native.jsfiles for terms that need renaming or removal).