Skip to content

fix: defer MediaManagerV2 Vue chunk until Vue CDN loads - #461

Merged
hellopablo merged 1 commit into
developfrom
cursor/vue3-mediamanager-v2-2921
Sep 7, 2026
Merged

fix: defer MediaManagerV2 Vue chunk until Vue CDN loads#461
hellopablo merged 1 commit into
developfrom
cursor/vue3-mediamanager-v2-2921

Conversation

@hellopablo

Copy link
Copy Markdown
Member

Summary

Follow-up to #460. Admin pages were throwing ReferenceError: Can't find variable: Vue because admin.min.js loads before Asset::vue3()’s CDN script.

Vue 2 never hit this: vue-loader 15 did not emit top-level from 'vue' imports. Vue 3 / vue-loader 17 does, and with externals: { vue: 'Vue' } that reads the global as soon as those modules evaluate.

Fix

  • Wait for window.Vue.createApp, then dynamic-import the MMV2 SFCs
  • Emit stable async assets: admin.mediamanager-v2.min.js + admin.mediamanager-v2.min.css
  • admin.min.js stays Vue-free at load time (still registers the plugin on every admin page)

Test plan

  • Other admin pages: no Can't find variable: Vue
  • Media Manager V2 page: app mounts after Vue CDN loads; styles present
  • Smoke filters / actions menu / upload / bucket selector
Open in Web Open in Cursor 

Vue 3 SFC compilation imports from 'vue' at module eval time.
admin.min.js is loaded on all admin pages before Asset::vue3(),
so a static Vue import threw ReferenceError. Vue 2 never did because
vue-loader 15 did not emit those top-level imports.

Dynamically import the MMV2 SFCs only after window.Vue.createApp
exists, and emit a stable admin.mediamanager-v2 async chunk + CSS.

Co-authored-by: Pablo de la Peña <pablo@hellopablo.co.uk>
@hellopablo
hellopablo marked this pull request as ready for review September 7, 2026 19:18
@hellopablo
hellopablo merged commit 1176999 into develop Sep 7, 2026
4 checks passed
@hellopablo
hellopablo deleted the cursor/vue3-mediamanager-v2-2921 branch September 7, 2026 19:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants