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

a dozen Vue.use statements were stripped from my main.js #28

Closed
vesper8 opened this issue May 1, 2020 · 3 comments
Closed

a dozen Vue.use statements were stripped from my main.js #28

vesper8 opened this issue May 1, 2020 · 3 comments
Labels
bug Something isn't working

Comments

@vesper8
Copy link

vesper8 commented May 1, 2020

I just tried adding this plugin to an existing project to see what would happen. It did a lot of changes, mostly renaming props to use #, changing dependencies in my package.json and making a few changes in my main.js

One change that didn't make any sense to me is that it removed all this:

Vue.use(BootstrapVue);
Vue.use(Notifications);
Vue.use(ToggleButton);
Vue.use(VueChatScroll);
Vue.use(VueCookie);
Vue.use(VueFormGenerator);
Vue.use(VueLazyload);
Vue.use(VueSweetalert2);
Vue.use(VueGeolocation);
Vue.use(vClickOutside);
Vue.use(device);
Vue.use(PortalVue);

while leaving:

import BootstrapVue from 'bootstrap-vue';
import Notifications from 'vue-notification';
import ToggleButton from 'vue-js-toggle-button';
import VueChatScroll from 'vue-chat-scroll';
import VueCookie from 'vue-cookie';
import VueFormGenerator from 'vue-form-generator';
import VueLazyload from 'vue-lazyload';
import VueSweetalert2 from 'vue-sweetalert2';
import vClickOutside from 'v-click-outside';
import VueGeolocation from '@/plugins/GeoLocation';
import device from 'vue-device-detector';
import PortalVue from 'portal-vue';

Is this right? are imports now sufficient and you no longer need to add Vue.use ?

@sodatea
Copy link
Member

sodatea commented May 8, 2020

There's no Vue.use in Vue 3.
So the signature of third-party plugins needs some change.
Per the experience from vue-router & vuex, a possible new API is like app.use(router) where router used to be a root component option in Vue 2.

At the time of developing this plugin, I assume users only use the core packages as most third-party libraries haven't been upgraded to Vue 3. So I wrote a straightforward codemod to strip Vue.use and turn root options to app.use().

This is no longer correct though. As of vuetify@next, app.use still expects .use(Vuetify). I'll fix the code logic in the next version.

@sodatea sodatea added the bug Something isn't working label May 8, 2020
@mariusa
Copy link

mariusa commented Jun 30, 2020

@sodatea ping for next version fix? Hope all is good with you in China?

@sodatea
Copy link
Member

sodatea commented Jul 2, 2020

Thanks for reminding me.
I'm busy with some personal stuff and will be off for the next few days. I may have the time to fix the bugs later next week.

Meanwhile, it's hard to get everything right for a plugin that is invoked after the project scaffolding, considering there may be unexpected third-party libraries that are not supported.
So I'm working on a PR to directly create Vue 3 projects with Vue CLI vuejs/vue-cli#5637 Hopefully it will be included in the mid-July release. People will no longer need this plugin after that release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants