11
votes

I try using Vue 3, but I look can't using Vue.use(exampleplugin) again.

I using command vue add bootstrap-vue after generate vue create project. And on plugin bootstrap-vue warning with code:

import Vue from "vue";

import BootstrapVue from "bootstrap-vue";
import "bootstrap/dist/css/bootstrap.min.css";
import "bootstrap-vue/dist/bootstrap-vue.css";

Vue.use(BootstrapVue);

Output warning terminal:

warning in ./src/plugins/bootstrap-vue.js

"export 'default' (imported as 'Vue') was not found in 'vue'

warning in ./node_modules/bootstrap-vue/esm/utils/vue.js

"export 'default' (imported as 'Vue') was not found in 'vue'

What's wrong with that? And how do I use vue 3 to add plugin bootstrap-vue?

2
Pretty sure BootstrapVue isn't compatible with Vue 3 yet. You should probably stick with Vue 2Phil
Did you ever manage to figure this out? I have the same problem but for a different library. Importing it in ‘main.js’ and chaining a .use to the createApp call doesn’t work.Kopty

2 Answers

17
votes

Bootstrap Vue is not yet ready for Vue 3.

To answer part of your question, Vue 3 changes the method for instantiating the application instance, including how plugins are registered.

For example...

import { createApp } from 'vue';
import Router from './router/Router';

createApp({/* options */}})
  .use(Router)
  .mount('#app');

You can read more about this at the official docs.

https://v3.vuejs.org/guide/instance.html

https://v3.vuejs.org/guide/migration/introduction.html

-4
votes

At the time of this answer, Bootstrap-Vue doesn't support Vue 3 but BootstrapVue v4 will have Vue.js v3 support and Bootstrap v5 support according to this issue on GitHub so your only option now is to add Bootstrap manually to your project. Here is an article for the possible ways to add bootstrap to Vue 3