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

[Discussion] Shall we add something like Vue2 to vue-demi's export? #41

Closed
Justineo opened this issue Feb 25, 2021 · 2 comments · Fixed by #43
Closed

[Discussion] Shall we add something like Vue2 to vue-demi's export? #41

Justineo opened this issue Feb 25, 2021 · 2 comments · Fixed by #43

Comments

@Justineo
Copy link
Contributor

Justineo commented Feb 25, 2021

My use case is to config ignoredElements only in Vue 2. Currently we may use:

import { Vue, isVue2 } from 'vue-demi'

if (isVue2) {
  Vue.config.ignoredElements.push(...)
}

The problem is that when this code is run with Vue 3, Vue contains all tree-shakable exports which is not ideal.

So shall we add a Vue2 export from vue-demi so that we can use it like:

import { Vue2 } from 'vue-demi'

if (Vue2) {
  Vue2.config.ignoredElements.push(...)
}

And in Vue 3 mode we just export undefined from vue-demi so it doesn't hurt the bundle size.

@antfu
Copy link
Member

antfu commented Feb 25, 2021

Sounds like a good solution to me. Would you like to make a PR for it? I think we can mark the Vue entry as @depreacted so it won't break the existing code but also give clear info for developers to migrate. Thanks.

@Justineo
Copy link
Contributor Author

Sure.

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 a pull request may close this issue.

2 participants