None of this is needed to use the library, it's purely for understanding how it works.
To be able to generate modules
. vite-plugin-cdn2
will create a scanner at configResolved
hook. It' will create a new threads to record
the package infomation.(So your local environment need support threads).
const s = ['vue']
const s = {
vue: {
name: 'vue',
global: 'Vue',
// ... other info
}
}
The reason to vite-plugin-cdn2
can support export * from 'module'
is because that scanner stage can record all of the package bindings.(All export function or variable).
export * from 'vue'
export const ref = 1
export const { onMounted: Vue.onMounted, .... } = Vue // ingored ref because it was been rewrite
export const ref = 1
all of url will generate html element and binding it at transformIndexHtml