ziko-wrapper
Version:
integrate zikojs elements within other ui framework like vue react solidjs svelte astro ...
36 lines (30 loc) • 871 B
JavaScript
const astroZikojs = (options = {}) => {
const noExternal = options.noExternal || []
return {
name: "astro-zikojs",
hooks: {
"astro:config:setup": async ({ addRenderer, updateConfig, config }) => {
// 1. Register renderer
addRenderer({
name: "astro-zikojs",
serverEntrypoint: "ziko-wrapper/astro/server",
clientEntrypoint: "ziko-wrapper/astro/client",
})
// 2. Merge noExternal
const existing = config.vite?.ssr?.noExternal || []
if (noExternal.length) {
updateConfig({
vite: {
ssr: {
noExternal: [
...new Set([...existing, ...noExternal])
]
}
}
})
}
}
}
}
}
export default astroZikojs