-
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
Navigation: consistently provide fallback variations #30117
Conversation
Size Change: +521 B (0%) Total Size: 1.41 MB
ℹ️ View Unchanged
|
… build, add some basic tests
f5b5a36
to
ca02280
Compare
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.
😱 Wow, great catch—this is something I could imagine spending hours debugging to find!
You probably should also whitelist the file in: gutenberg/packages/block-library/package.json Lines 24 to 27 in 1d89cd9
to tell webpack that it contains side effects otherwise, tree-shaking might still trigger in the future. |
Thank you for figuring this one out, @gwwar! 🙌 |
TIL there's a whitelist for side-effects, @gziolo I can follow up 👍 |
There is a lot to learn there: https://github.com/WordPress/gutenberg/tree/trunk/packages#optimizing-for-bundlers |
Fixes #29984 where navigation link variations are missing in production builds.
The problem is that the following is called as a side effect of importing hooks.js in trunk. Since nothing is calling anything from hooks.js this was shaken out of the final build. This means that we saw links in our development build
npm run dev
but not when usingnpm run build
Props to @kjellr for finding this.
Testing Instructions
WP 5.7
npm run build
and enable the gutenberg plugin. Note use the build and not dev command.Expected: all fallback variations appear: (link, post link, page link, category, tag)
WP Latest
npm run build
and enable the gutenberg plugin. Note use the build and not dev command.Expected: variations appear (including custom variations from plugins). Each variation has the correct icon. Note that when using custom variations, there's a new post label that plugin authors have not had a chance to add:
To see the right labels, we can edit the plugin and add
item_link
anditem_link_description
to the taxonomy or post-type definition.