[READ-ONLY] Mirror of https://github.com/danielroe/cross-origin-storage. Load shared dependencies from Cross-Origin Storage (COS).
cross-origin-storage
experimental
nuxt
vite
vite-plugin
1import type { NitroApp } from 'nitropack/types'
2import scriptContent from 'virtual:cos-loader'
3
4export default (nitroApp: NitroApp) => {
5 nitroApp.hooks.hook('render:html', (ctx) => {
6 ctx.head = ctx.head.filter(tag => !tag.includes('<script type="module" src="/_nuxt'))
7 ctx.head.push(`<script id="cos-loader">${scriptContent}</script>`)
8 })
9}