Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

156
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!