diff --git a/lib/common/options.js b/lib/common/options.js index e685efe2a2..c6dabafb2c 100755 --- a/lib/common/options.js +++ b/lib/common/options.js @@ -305,7 +305,9 @@ Options.defaults = { push: false, shouldPush: null }, - static: {}, + static: { + prefix: true + }, gzip: { threshold: 0 }, diff --git a/lib/core/renderer.js b/lib/core/renderer.js index 234b2de1d8..d0169225b0 100644 --- a/lib/core/renderer.js +++ b/lib/core/renderer.js @@ -249,12 +249,12 @@ module.exports = class Renderer { } // For serving static/ files to / - this.useMiddleware( - serveStatic( - resolve(this.options.srcDir, 'static'), - this.options.render.static - ) + const staticMiddleware = serveStatic( + resolve(this.options.srcDir, 'static'), + this.options.render.static ) + staticMiddleware.prefix = this.options.render.static.prefix + this.useMiddleware(staticMiddleware) // Serve .nuxt/dist/ files only for production // For dev they will be served with devMiddleware