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

292
Visualizações
How can I add a file to the default bundle generated by Vite?

In the routing configuration of a Vue.js 2.x app, any statically imported components will be added to the default bundle. Any dynamically imported components will be saved in a separate bundle, e.g.

// routes.js
import Component1 from '@/component1.vue' // added to default bundle
import Component2 from '@/component2.vue' // added to default bundle

const Component3 = () => import('@/component3.vue') // saved in a bundle on its own
const Component4 = () => import('@/component4.vue') // saved in a bundle on its own

If I want to add a JavaScript file (not a Vue component) to the default bundle, I could also import in routes.js, but I then get an ESLint warning/error that I've an unused import.

import myService from '@/services/my-service.js' // eslint-disable-line no-unused-vars 

The app in question is built with Vite which uses Rollup to bundle files. Is there a more elegant way to add a .js file to the default bundle, e.g. via the rollupOptions in vite.config.js

about 4 years ago · Juan Pablo Isaza
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