My project is vue3+vite, and I'm using the vite-plugin-cdn-import plugin for CDN configuration. but cann't find VuePdfEmbed.
vv19901217 opened this issue · 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/vue-pdf-embed@1.2.1/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.
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