mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-23 14:15:13 +00:00
feat(server): allow disabling serve-static
middleware (#9365)
closes #9362
This commit is contained in:
parent
b9bfb9df01
commit
40521d0a0d
@ -87,6 +87,7 @@ export default class Server {
|
|||||||
this.useMiddleware(createTimingMiddleware(this.options.server.timing))
|
this.useMiddleware(createTimingMiddleware(this.options.server.timing))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.options.render.static !== false) {
|
||||||
// For serving static/ files to /
|
// For serving static/ files to /
|
||||||
const staticMiddleware = serveStatic(
|
const staticMiddleware = serveStatic(
|
||||||
path.resolve(this.options.srcDir, this.options.dir.static),
|
path.resolve(this.options.srcDir, this.options.dir.static),
|
||||||
@ -94,6 +95,7 @@ export default class Server {
|
|||||||
)
|
)
|
||||||
staticMiddleware.prefix = this.options.render.static.prefix
|
staticMiddleware.prefix = this.options.render.static.prefix
|
||||||
this.useMiddleware(staticMiddleware)
|
this.useMiddleware(staticMiddleware)
|
||||||
|
}
|
||||||
|
|
||||||
// Serve .nuxt/dist/client files only for production
|
// Serve .nuxt/dist/client files only for production
|
||||||
// For dev they will be served with devMiddleware
|
// For dev they will be served with devMiddleware
|
||||||
|
Loading…
Reference in New Issue
Block a user