fix(plugin): rebuild admin extensions in develop mode - #15506
Conversation
Why: - plugin:develop ignored src/admin changes, so custom admin routes only refreshed after plugin:publish - watching admin extensions and rebuilding them feeds the existing yalc publish callback Verified: - git diff --check
🦋 Changeset detectedLatest commit: acaebe3 The changes in this PR will be included in the next version bump. This PR includes changesets to release 78 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Thank you for your contribution, @Chris79OG! Nice scoping on this — the fix is focused and the linked issue (#15505) is verified and tagged A few things to address before we can move forward: Required changes:
Notes (non-blocking):
Triggered by: new PR opened |
|
Thanks for addressing the earlier feedback, @Chris79OG! 🎉 After a second look, this PR is in good shape: ✅ PR template now complete (What/Why/How/Testing) A team member will do the final review before this is merged. Notes (non-blocking):
Triggered by: new commit pushed |
|
Thanks for the quick turnaround, @Chris79OG! 🎉 Both prior required changes have been addressed: ✅ Changeset added with the correct After this round of review, this PR looks good to us: ✅ Linked to a verified issue (#15505, tagged Notes (non-blocking):
A team member will do the final review before merging. Thanks again! Triggered by: PR description updated |
|
Thanks for the follow-up, @Chris79OG! 🎉 The new commit cleanly addresses the prior non-blocking note — Nothing else has surfaced since the last review: ✅ PR template complete (What/Why/How/Testing)
Triggered by: new commit pushed |
|
This PR is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 5 days. |
|
This PR is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 5 days. |
|
@Chris79OG I haven't been able to reproduce the issue so won't be picking this up until I have clear reproduction steps. Did you experience this issue yourself? |
Summary
What — What changes are introduced in this PR?
This adds plugin admin extension handling to
medusa plugin:develop: admin extensions are built on startup whensrc/adminexists, watched during development, and rebuilt when files are added, changed, or removed.Why — Why are these changes relevant or necessary?
plugin:developcurrently republishes backend plugin changes, but admin route changes are not rebuilt or republished while the command is running. This leaves plugin authors restarting the develop command to see admin extension changes, which is the issue reported in #15505.How — How have these changes been implemented?
The develop command now initializes the admin bundler, builds plugin admin extensions once before entering watch mode, and starts a
src/adminwatcher through the framework compiler. The watcher coalesces rapid changes while a build is already running, rebuilds admin extensions through the existing bundler path, and only triggers the existing publish callback after a successful admin build. It also logs when the admin extension watcher is ready, matching the backend watcher experience.Testing — How have these changes been tested, or how can the reviewer test the feature?
Local verification:
git diff --checkReviewer repro path:
src/adminextension.medusa plugin:develop.src/admin.Examples
A plugin with
src/admin/routes/custom/page.tsxcan keepmedusa plugin:developrunning while editing that route. The plugin admin extension build is rerun after the file change and the updated plugin package is republished through the same yalc callback used for backend changes.Checklist
Please ensure the following before requesting a review:
Additional Context
Fixes #15505.
I did not add a dedicated chokidar integration test because this path depends on the plugin develop watcher lifecycle and admin bundler side effects. The implementation reuses the existing
buildPluginAdminExtensionspath and the existing publish callback, with a small queue around rebuilds to avoid overlapping admin builds during rapid file changes.