vue-pdf-embed icon indicating copy to clipboard operation
vue-pdf-embed copied to clipboard

My project is vue3+vite, and I'm using the vite-plugin-cdn-import plugin for CDN configuration. but cann't find VuePdfEmbed.

Open vv19901217 opened this issue 1 year ago • 1 comments

My project is vue3+vite, and I'm using the vite-plugin-cdn-import plugin for CDN configuration. Here is the code I'm using:

import { Plugin as ImportToCDN} from 'vite-plugin-cdn-import' const createCdnListImport = (isBuild) => { return isBuild? ImportToCDN({ modules: [ { name: 'vue-pdf-embed', var: 'VuePdfEmbed', path: 'https://unpkg.com/[email protected]/dist/vue3-pdf-embed.js' } // autoComplete('@vueuse/core') ] }): [] }

In vite.config.js, I added the following under rollupOptions: ignoreExternal: ['vue-pdf-embed'], and also configured the globals in the output section: globals: { 'vue-pdf-embed': 'VuePdfEmbed' }. However, after deploying, I found that VuePdfEmbed is not accessible in the browser environment. I hope to find a solution to this issue.

vv19901217 avatar Dec 28 '23 08:12 vv19901217

Because this chunk does not contain vue, you need to externalize vue. BTW vite-plugin-cdn-import has no maintenance for a long time, why not try vite-plugin-cdn2

nonzzz avatar Jan 02 '24 12:01 nonzzz