Combining TypeScript with Vue3 to implement bootstrapVue

After using BootstrapVue as any, the error was corrected but unfortunately it still doesn't work in the browser.

Here is what's inside main.ts:

import { createApp }from 'vue';
import App from './App.vue';
import router from './router';
import Release from './components/Release.vue'; // @ is an alias to /src
import {BootstrapVue} from 'bootstrap-vue';

// Import Bootstrap and BootstrapVue CSS files (order matters)
import 'bootstrap/dist/css/bootstrap.css'
import 'bootstrap-vue/dist/bootstrap-vue.css'

// Optionally install the BootstrapVue icon components plugin
//use(BootstrapVue as any) can correct.
createApp(App).use(BootstrapVue).component('Release', Release)
.use(router).mount('#app')

Error encountered when running npm run serve:

 WAIT  Compiling...                                                                                         9:57:17 AM

98% after emitting CopyPlugin

 WARNING  Compiled with 1 warning                                                                           9:57:18 AM

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

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


  App running at:
  - Local:   http://localhost:8080/ 

Issues checking in progress...

ERROR in src/main.ts:15:20

TS2345: Argument of type 'BootstrapVuePlugin' is not assignable to parameter of type 'Plugin_2'.

Type 'BootstrapVuePlugin' is not assignable to type '{ install: PluginInstallFunction; }'.

    Types of property 'install' are incompatible.

      Type 'PluginFunction<BvConfigOptions>' is not assignable to type 'PluginInstallFunction'.

        Types of parameters 'Vue' and 'app' are incompatible.

          Type 'App<any>' is missing the following properties from type 'VueConstructor<Vue>': extend, nextTick, set, delete, and 3 more.

    13 | // Optionally install the BootstrapVue icon components plugin

    14 | //Vue.use(IconsPlugin).use(BootstrapVue as any)

  > 15 | createApp(App).use(BootstrapVue).component('Release', Release)

       |                    ^^^^^^^^^^^^

    16 | .use(router).mount('#app')

Browser Console Output:

Uncaught TypeError: Cannot read property 'prototype' of undefined

    at eval (config.js?228e:6)

    at Module../node_modules/bootstrap-vue/esm/utils/config.js (chunk-vendors.js:3924)

    at __webpack_require__ (app.js:849)

    at fn (app.js:151)

    at eval (props.js?cf75:1)

    at Module../node_modules/bootstrap-vue/esm/utils/props.js (chunk-vendors.js:4200)

    at __webpack_require__ (app.js:849)

    at fn (app.js:151)

    at eval (model.js?58f2:1)

    at Module../node_modules/bootstrap-vue/esm/utils/model.js (chunk-vendors.js:4116)

Answer №1

If you want to utilize the latest version of Bootstrap Vue, make sure to install bootstrap-vue-3

To do so, run the command: npm i --save bootstrap-vue-3

After installing, be sure to add the following lines to either your main.js or main.ts file:

// Setting up Bootstrap Vue
import BootstrapVue3 from 'bootstrap-vue-3';
app.use(BootstrapVue3);

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Tips for showcasing with [displayWith] in Material2's AutoComplete feature

My API returns an array and I am using Material2#AutoComplete to filter it. While it is working, I am facing an issue where I need to display a different property instead of the currently binded value in the option element. I understand that I need to uti ...

Updating nested interface values using React hooks

I am looking to develop an application that can seamlessly update a nested configuration file after it has been imported (similar to swagger). To achieve this, I first created a JSON configuration file and then generated corresponding interfaces using the ...

Switching Next.js JavaScript code to Typescript

I am currently in the process of transforming my existing JavaScript code to TypeScript for a web application that I'm developing using Next.Js Here is the converted code: 'use client' import React, { useState, ChangeEvent, FormEvent } fro ...

Error encountered while uploading a file with Fastify and Nestjs

I encountered an issue while attempting to upload a file to my nest.js server, receiving the following error message: Error: Unsupported Media Type: multipart/form-data; boundary=--------------------------140603536005099484714904 https://i.sstatic.net/ ...

The type definition file for '@types' is not present in Ionic's code base

After updating my Ionic 6 project to use Angular 3, everything works perfectly in debug mode. However, when I attempt to compile for production using 'ionic build --prod' or 'ionic cordova build android --prod', I encounter the followin ...

How can I load data into Vuex store before the application starts?

Within the created hook of App.vue, I am initiating a dispatch call to my store. Subsequently, in a child component, I attempt to retrieve this data using a getter. However, an issue arises as the child component is loaded before the data is stored, causin ...

Exploring Angular 17's unique approach to structuring standalone components

Is something wrong with my code if I can only see the footer, header, and side-nav components on localhost? How can I fix this? app.component.html <div class="container-fluid"> <div class="row"> <div class=&q ...

conditional rendering in a cascading sheet

Can the v-if directive be used within a style block in this manner? <style lang="scss" v-if="pinkTheme"> .ac-textfield { background: hotpink; } </style> I attempted to implement this, but unfortunately it did not work (the v-if directive ...

Input boxes next to each other in a Vuetify form

Is it possible to place multiple input controls next to each other using v-form? Thanks This is my code, I want to have the text edits side by side (2 on each line) <v-form ref="form" v-model="valid"> <v-select :items ...

Programmatically toggle the visibility of an ion fab button

Looking for assistance in finding a method to toggle the visibility of a particular button within the collection of buttons in an ion-fab https://i.sstatic.net/vkFrP.png ...

Looking for ways to streamline your React and Vue projects by reducing the number of

Coming from a background in emacs and xterm, I am accustomed to working with just a few files and having complete control over my work. Now I am delving into the world of React and Vue, but I was taken aback when I saw the sheer number of files generated f ...

How can I add an object to an array of objects in Vue.js?

Hey there! I'm new to Vue and currently working on understanding the whole concept of Vue and how to use it. Right now, my focus is on learning lists. JS: Vue.config.productionTip = false; new Vue({ el: '#app', data: { items: [ ...

What is the best way to ensure a null-check is performed before accessing the value in ref() in Vue3?

I am encountering some issues where the availability of modelInfo to access is not consistent. Please take note: modelInfo?.value.model_owner const summaryItems = ref({ title: "Model Summary", items: { "Model Owner": getFull ...

Tips for directing your attention to an input field in Angular

I'm struggling to find a simple solution for setting focus programmatically in Angular. The closest answer I found on Stack Overflow is about dynamically created FormControl, but it seems more complex than what I need. My situation is straightforward ...

Struggling to Enforce Restricted Imports in TypeScript Project Even After Setting baseUrl and resolve Configuration

I am facing challenges enforcing restricted imports in my TypeScript project using ESLint. The configuration seems to be causing issues for me. I have configured the baseUrl in my tsconfig.json file as "src" and attempted to use modules in my ESLint setup ...

Specify the correct type for the SVG component when passing it as a prop

Currently, I am in the process of constructing a button component: interface ButtonProps { startIcon?: ... <-- what should be the data type here? } const Button = ({startIcon: StartIcon}) => { return <button>{StartIcon && <Sta ...

Deciphering a mysterious message in Typescript while defining a function for one of my tasks

Currently, I am working with a stack that includes React, TypeScript, and Redux. Unfortunately, I have encountered an issue while using an interface for one of my actions. The error message I received is quite cryptic: Duplicate identifier 'number&apo ...

Is it possible for a class that implements an interface to have additional fields not defined in the parent interface?

Looking at the code snippet below, my aim is to ensure that all classes which implement InterfaceParent must have a method called add that takes an instance of either InterfaceParent or its implementing class as input and returns an instance of InterfacePa ...

I'm having trouble viewing the unique Google Map design on my application

I have recently customized Google maps following the guidelines in this documentation: https://developers.google.com/maps/documentation/javascript/styling For styling, I utilized the Cloud tool and opted for the available template instead of using JSON st ...

Encountering an error message when trying to launch the Vue.js dev server: "The plugins[0] should only consist of a two-tuple or three

I'm currently using Vue CLI version 3 to run a Vue application within a Docker container. When I try to start the development server, I encounter the following issue: https://cli.vuejs.org/guide/cli-service.html The error message displayed is as fol ...