The following are my questions. I packaged my project in library mode via vite. Whenever my library includes any third party UI library like vue-loading-overlay, the error occurs. But other libraries like moment.js won’t have a problem.
This is my vite.config.js, is there something wrong with my configuration?
import { defineConfig } from "vite"; import vue from "@vitejs/plugin-vue"; export default defineConfig({ plugins: [vue()], build: { lib: { entry: resolve(__dirname, "src/lib.ts"), name: "my-ui-lib", fileName: "my-ui-lib", }, rollupOptions: { external: ["vue"], output: [ { format: "es", exports: "named", globals: { vue: "vue" }, }, ], }, }, });
Finally I solved my problem by adding the following content in vite.config.js. It works for me.