sanity
Version:
Sanity is a real-time content infrastructure with a scalable, hosted backend featuring a Graph Oriented Query Language (GROQ), asset pipelines and fast edge caches
20 lines (17 loc) • 445 B
text/typescript
import {type Plugin} from 'vite'
export function sanityRuntimeRewritePlugin(): Plugin {
return {
name: 'sanity/server/sanity-runtime-rewrite',
apply: 'serve',
configureServer(viteDevServer) {
return () => {
viteDevServer.middlewares.use((req, res, next) => {
if (req.url === '/index.html') {
req.url = '/.sanity/runtime/index.html'
}
next()
})
}
},
}
}