Skip to content
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

[backport v2.8.next2] [Extensions] Expose UMD Builds of Vue to the window Object #10569

Merged
merged 2 commits into from
Apr 3, 2024

Conversation

github-actions[bot]
Copy link
Contributor

@github-actions github-actions bot commented Mar 6, 2024

This is an automated request to port PR #10544 by @rak-phillip

closes #10568

Original PR body:

Summary

This resolves an error where importing extensions that utilize backported features will throw the error object(...) is not a function by explicitly importing vue.runtime to ensure that Dashboard is always exposing the UMD builds of Vue to the window object. This error originally occurred because different builds of Vue (ESM vs. UMD) are used depending on the environment; there are differences in how backported Vue 3 features are exposed in Vue 2.71, so it's important that the intended build is explicitly attached to the window object so that extensions can be imported without error.

For more information on different builds that are available to us, see the vue documentation for explanation of different builds 2.

This also bumps the UI_PLUGIN_API_VERSION to signal that upcoming changes to UI extensions will be incompatible with older versions of Dashboard. A version of 1.2.0 or higher will be required for extensions that utilize backported Vue 3 features that are available in Vue 2.7.

Fixes #10543

Areas or cases that should be tested

  • Loading an interacting with existing extensions does not regress
  • Loading extensions that utilize backported Vue 3 features behaves the same as existing extensions
  • Development & Production builds of Dashboard should behave the same when loading and interacting with extensions
  • No new errors are logged as a result of this change

Screenshots

Screen.Recording.2024-03-05.at.16.47.21.mov

Checklist

  • The PR is linked to an issue and the linked issue has a Milestone, or no issue is needed
  • The PR has a Milestone
  • The PR template has been filled out
  • The PR has been self reviewed
  • The PR has a reviewer assigned
  • The PR has automated tests or clear instructions for manual tests and the linked issue has appropriate QA labels, or tests are not needed
  • The PR has reviewed with UX and tested in light and dark mode, or there are no UX changes

Footnotes

  1. https://v2.vuejs.org/v2/guide/migration-vue-2-7.html#Notes-on-API-exposure

  2. https://v2.vuejs.org/v2/guide/installation#Explanation-of-Different-Builds

This explicitly targets `node_modules/vue/dist/vue.js` to ensure that Dashboard is always exposing the UMD builds of Vue to the `window` object (`shell/core/plugins-loader.js`). For more information on different builds that are available to us, see the vue documentation for explanation of different builds [^1]

[^1]: https://v2.vuejs.org/v2/guide/installation#Explanation-of-Different-Builds

Signed-off-by: Phillip Rak <rak.phillip@gmail.com>
This bumps the `UI_PLUGIN_API_VERSION` to signal that upcoming changes to UI extensions will be incompatible with older versions of Dashboard. A version of 1.2.0 or higher will be required for extensions that utilize backported Vue 3 features that are available in Vue 2.7.

Signed-off-by: Phillip Rak <rak.phillip@gmail.com>
Copy link
Member

@aalves08 aalves08 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@rak-phillip rak-phillip merged commit 105a6c0 into release-2.8 Apr 3, 2024
2 checks passed
@rak-phillip rak-phillip deleted the gha-portpr-8175926167-1 branch April 3, 2024 14:49
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