Fix missing wp-views script dependency notice#3084
Open
Conversation
The webpack config was externalizing @wordpress/views to wp-views, but WordPress core does not register that script handle. This caused a missing dependency notice in WP 6.9.1+ and a potential runtime error. The default DependencyExtractionWebpackPlugin already lists @wordpress/views in BUNDLED_PACKAGES, so removing the custom override lets it be bundled correctly.
There was a problem hiding this comment.
Pull request overview
Updates the build configuration to stop externalizing @wordpress/views as wp-views, avoiding the unregistered dependency notice in WordPress 6.9.1+ by bundling the package instead.
Changes:
- Removes the custom
DependencyExtractionWebpackPluginoverride that mapped@wordpress/viewstowp-views. - Re-adds
DependencyExtractionWebpackPluginwith default behavior so@wordpress/viewsis bundled. - Updates built assets and asset manifests to reflect the new dependency graph (notably removing
wp-viewsfromindex.asset.php).
Reviewed changes
Copilot reviewed 7 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| webpack.config.js | Removes custom dependency extraction override and relies on default bundling for @wordpress/views. |
| build/app/index.asset.php | Drops wp-views from the generated dependency list. |
| build/app/index.js | Regenerated bundle output reflecting updated dependency extraction and chunking. |
| build/app/vendors.js | Regenerated vendor bundle output after dependency extraction change. |
| build/app/vendors.asset.php | Updates vendor asset version hash after rebuild. |
| build/app/tanstack-router.asset.php | Updates asset version hash after rebuild. |
| build/app/feed-content.701ed0f6.js | Removes an outdated chunk file generated prior to the rebuild. |
| .github/changelog/3084-from-description | Adds changelog entry for the fix. |
Comments suppressed due to low confidence (1)
build/app/index.js:1
- The regenerated runtime now points chunk id
579toapp/feed-content.51a9b6b8.js, but this PR showsbuild/app/feed-content.701ed0f6.jsbeing removed and does not include the newly referenced chunk file. Unlessbuild/app/feed-content.51a9b6b8.jsis added elsewhere in the PR, the app will 404 when loading that chunk and break the admin UI. Ensure the new chunk file is committed (or the chunk naming remains consistent) alongside the updatedindex.js.
(()=>{"use strict";var e,t,i,r,n,a={6007(e,t,i){i.d(t,{A:()=>a,k:()=>n});var r=i(790);const n="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 200'%3E%3Crect width='200' height='200' fill='%23f0f0f0'/%3E%3Cpath fill='%23c6c6c6' d='M32,201 C22,201 12,201 1,201 C1,134 1,68 1,1 C68,1 134,1 201,1 C201,68 201,134 201,201 C194,201 186,201 178,201 C174,184 165,172 149,166 C145,164 139,163 134,162 C131,161 128,160 126,158 C123,156 122,154 126,151 C147,137 154,112 145,89 C139,70 122,58 104,59 C90,59 79,66 71,77 C54,101 60,135 84,151 C88,154 88,155 84,158 C81,160 78,161 75,162 C53,167 38,179 32,201z'/%3E%3C/svg%3E";function a({item:e}){const t=e.actor_info?.icon||n,i=e.actor_info?.name||e.actor_info?.username||"";return(0,r.jsx)("img",{alt:i,src:t,className:"activitypub-avatar",onError:e=>{e.target.src=n},...!i&&{role:"presentation"}})}},9993(e,t,i){i.d(t,{l:()=>w,M:()=>x});var r=i(3582),n=i(7143),a=i(6427),s=i(7723),o=i(7947),c=i(7028),l=i(3560),d=i(4539),p=i(5506),u=i(2285),m=i(8087),v=i(7884),f=i(618),h=i(3834),b=i(6087),_=i(4242),g=i(9304),y=i(790);const x={Article:{label:(0,s.__)("Articles","activitypub"),icon:o.A},Note:{label:(0,s.__)("Notes & Updates","activitypub"),icon:c.A},Image:{label:(0,s.__)("Photos & Images","activitypub"),icon:l.A},Event:{label:(0,s.__)("Events & Meetups","activitypub"),icon:d.A},Video:{label:(0,s.__)("Videos","activitypub"),icon:p.A},Audio:{label:(0,s.__)("Music & Podcasts","activitypub"),icon:u.A},Document:{label:(0,s.__)("Documents & Files","activitypub"),icon:m.A},Page:{label:(0,s.__)("Pages","activitypub"),icon:v.A},Place:{label:(0,s.__)("Places & Locations","activitypub"),icon:f.A}};function w(){const e=(0,n.useSelect)(e=>e(h.E).getActiveActorId(),[]),t=null!==e,{records:i,isResolving:o}=(0,r.useEntityRecords)("taxonomy","ap_object_type",t?{per_page:-1,user_id:e}:void 0),{selectedObjectTypeId:c,updateObjectTypeFilter:l}=function(){const e=(0,g.Zp)(),{view:t,updateView:i}=(0,_.l)({kind:"postType",name:"ap_post",slug:"feed",defaultView:{type:"list",filters:[]}});return{selectedObjectTypeId:(0,b.useMemo)(()=>{var e;const i=t.filters?.find(e=>"ap_object_type"===e.field);return null!==(e=i?.value)&&void 0!==e?e:null},[t.filters]),updateObjectTypeFilter:(0,b.useCallback)((r,n={})=>{const a=t.filters||[],s=a.findIndex(e=>"ap_object_type"===e.field);let o;o=null===r?a.filter(e=>"ap_object_type"!==e.field):-1!==s?a[s].value===r?a.filter(e=>"ap_object_type"!==e.field):[...a.slice(0,s),{field:"ap_object_type",operator:"is",value:r},...a.slice(s+1)]:[...a,{field:"ap_object_type",operator:"is",value:r}],i({...t,filters:o,page:1}),e({search:e=>{const{postId:t,...i}=e;return i}}),n.onComplete&&n.onComplete()},[t,i,e])}}();if(o||!i||0===i.length)return null;const d=i.filter(e=>!!x[e.name]);if(d.length<=1)return null;const p=Object.keys(x),u=[...d].sort((e,t)=>p.indexOf(e.name)-p.indexOf(t.name));return(0,y.jsx)(a.MenuGroup,{className:"object-types-menu",children:u.map(e=>{const t=x[e.name];return(0,y.jsxs)(a.MenuItem,{onClick:()=>{return t=e.id,l(c===t?null:t);var t},className:"menu-item","aria-pressed":c===e.id,"aria-label":/* translators: %s: object type name */ /* translators: %s: object type name */
…bpackPlugin Instead of removing and re-adding the plugin, keep the original instance from @wordpress/scripts. The default plugin already bundles @wordpress/views (listed in BUNDLED_PACKAGES) since WordPress core does not register a corresponding wp-views script handle.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Proposed changes:
wp-viewsunregistered dependency notice introduced in WordPress 6.9.1 by bundling@wordpress/viewsinstead of externalizing it.The webpack config was externalizing
@wordpress/viewsto thewp-viewsscript handle, but WordPress core does not register that handle. The defaultDependencyExtractionWebpackPluginalready lists@wordpress/viewsin itsBUNDLED_PACKAGES, so removing the custom override lets it be bundled correctly.Other information:
Not applicable — this is a build configuration fix.
Testing instructions:
npm run env-startwp-viewsin the debug logChangelog entry
Changelog Entry Details
Significance
Type
Message
Fix a missing script dependency notice on the admin page in WordPress 6.9.1 and later.