Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

295
Visualizações
How to make Bootstrap-Vue / Vue 2 work with Vite

I have a project running some Vue2/BootstrapVue components, setup on webpacker, and I'm trying to migrate from webpacker to vite and got some Bootstrap Vue issues along the way, like Multiple instances of Vue detected or $attr and $listeners is readonly, just like described in BootstrapVue's documentation here

Now, in order to fix this, in webpacker, somewhere in my config i was doing this:

const resolver = {
   resolve: {
      alias: {
         'vue$': 'vue/dist/vue.esm.js'
      }
   }
};

environment.config.merge(resolver)

I tried doing something similar in vite, by adding the following in my vite.config.ts file, but this doesn't seem to work, so I'm probably not doing it right:

import {defineConfig} from 'vite'
import RubyPlugin from 'vite-plugin-ruby'
import {createVuePlugin} from "vite-plugin-vue2";

export default defineConfig({
    plugins: [
        RubyPlugin(),
        createVuePlugin()
    ],
    resolve: {
        alias: {
            'vue$': 'vue/dist/vue.esm.js'
        }
    }
})

So my question is what would be the recommended fix for this issue

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Vite provides a resolve.dedupe setting which you can use when running into duplication problems:

export default defineConfig({
  resolve: {
    dedupe: ['vue', 'vue-router'],
  },
})

However, this is not usual for vue, in most cases it works well out of the box.

Try removing the vue$ alias and switch your imports to use vue, Vite should automatically optimize it as a dependency and correctly resolve imports.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda