mirror of
https://github.com/nuxt/nuxt.git
synced 2025-01-31 07:40:33 +00:00
feat: serve-placeholder
This commit is contained in:
parent
a6936ff8c6
commit
0b886cf57f
@ -5,6 +5,7 @@ import debounce from 'debounce'
|
|||||||
import chokidar from 'chokidar'
|
import chokidar from 'chokidar'
|
||||||
import { listen, Listener } from 'listhen'
|
import { listen, Listener } from 'listhen'
|
||||||
import serveStatic from 'serve-static'
|
import serveStatic from 'serve-static'
|
||||||
|
import servePlaceholder from 'serve-placeholder'
|
||||||
import { createProxy } from 'http-proxy'
|
import { createProxy } from 'http-proxy'
|
||||||
import { stat } from 'fs-extra'
|
import { stat } from 'fs-extra'
|
||||||
import type { SigmaContext } from './context'
|
import type { SigmaContext } from './context'
|
||||||
@ -68,6 +69,10 @@ export function createDevServer (sigmaContext: SigmaContext) {
|
|||||||
return next()
|
return next()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// serve placeholder 404 assets instead of hitting SSR
|
||||||
|
app.use(sigmaContext._nuxt.publicPath, servePlaceholder())
|
||||||
|
app.use(sigmaContext._nuxt.routerBase, servePlaceholder({ skipUnknown: true }))
|
||||||
|
|
||||||
// SSR Proxy
|
// SSR Proxy
|
||||||
const proxy = createProxy()
|
const proxy = createProxy()
|
||||||
app.use((req, res) => {
|
app.use((req, res) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user