Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

159
Vistas
Build Vite Vue for production than PKG it, but keep external one ES module library

I have this Vue (Vite) that after build will be packaged with Vercel PKG. One of the ESModule library must be kept external, (not in the Vue production build).

The purpose of it is that after pkg package, this external lib can be updated without the need of the rebuild of the PKG package.

I have tried everything Vite docs says about external vue build. This is my last approach to make it happen:

export default defineConfig({
    build: {
        rollupOptions: {
            external: ["../custom/custom.es.js"],
        },
    },
    plugins: [
        vue()
    ]
});

Here is where I use the library - (vue main.ts)

import { createApp } from 'vue';
const App from './App.vue';
const app = createApp(App);

import CustomComponents from '../custom/custom.es.js';

app.use(CustomComponents);
app.mount('#app');

The problem is that Vite build keeps including this external lib into the production bundle file and loading not from the external library, but the context in the production code.

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda