Search code examples
javascripttypescriptvue.jsimportbootstrap-vue

Importing BootstrapVue 3


Here You can find the code with image

import { createApp } from "vue"; import App from "./App.vue"; import BootstrapVue3 from "bootstrap-vue-3"

import 'bootstrap/dist/css/bootstrap.css' import 'bootstrap-vue-3/dist/bootstrap-vue-3.css'

const app = createApp(App);

app.use(BootstrapVue3);

app.mount("#app");

It Causes an error in a given line of code as following

app.use(BootstrapVue3);

Argument of type 'Plugin_2<any[]>' is not assignable to parameter of type 'Plugin_2'.
  Type '((app: App<any>, ...options: any[]) => any) & { install?: ((app: App<any>, ...options: any[]) => any) | undefined; }' is not assignable to type 'Plugin_2'.

Solution

  • This package is deprecated and the repo was moved to bootstrap-vue organization. https://www.npmjs.com/package/bootstrap-vue-3 enter image description here

    Here is the installation process of bootstrap-vue

    # with npm
    npm install vue bootstrap bootstrap-vue
    # with yarn
    npm install vue bootstrap bootstrap-vue
    

    Then, register BootstrapVue in your app entry point (typically app.js or main.js)

    import Vue from 'vue'
    import { BootstrapVue, IconsPlugin } from 'bootstrap-vue'
    
    // Import Bootstrap and BootstrapVue CSS files (order is important)
    import 'bootstrap/dist/css/bootstrap.css'
    import 'bootstrap-vue/dist/bootstrap-vue.css'
    
    // Make BootstrapVue available throughout your project
    Vue.use(BootstrapVue)
    // Optionally install the BootstrapVue icon components plugin
    Vue.use(IconsPlugin)
    

    You can also follow the bellow link. https://bootstrap-vue.org/docs#using-module-bundlers