diff --git a/lib/build.js b/lib/build.js index 7ebb48ff79..5fad7af3b1 100644 --- a/lib/build.js +++ b/lib/build.js @@ -516,7 +516,6 @@ function createRenderer (bundle, manifest) { cache: cacheConfig, clientManifest: manifest, runInNewContext: false, - inject: false, baseDir: this.options.dir }, this.options.build.ssr)) this.renderToString = pify(this.renderer.renderToString) diff --git a/lib/nuxt.js b/lib/nuxt.js index 55fcf1919a..8f14748332 100644 --- a/lib/nuxt.js +++ b/lib/nuxt.js @@ -50,11 +50,10 @@ class Nuxt { extendRoutes: null, scrollBehavior: null }, - performance: { + render: { gzip: { threshold: 0 - }, - prefetch: true + } }, watchers: { webpack: {}, @@ -94,9 +93,9 @@ class Nuxt { this.serveStaticNuxt = pify(serveStatic(resolve(this.dir, '.nuxt', 'dist'), { maxAge: (this.dev ? 0 : '1y') // 1 year in production })) - // gzip for production - if (!this.dev && this.options.performance.gzip) { - this.gzipMiddleware = pify(compression(this.options.performance.gzip)) + // gzip middleware for production + if (!this.dev && this.options.render.gzip) { + this.gzipMiddleware = pify(compression(this.options.render.gzip)) } // Add this.Server Class this.Server = Server diff --git a/lib/render.js b/lib/render.js index c8c91fe617..dcdc4c9415 100644 --- a/lib/render.js +++ b/lib/render.js @@ -30,7 +30,7 @@ export async function render (req, res) { await this.webpackDevMiddleware(req, res) await this.webpackHotMiddleware(req, res) } - if (!this.dev && this.options.performance.gzip) { + if (!this.dev && this.options.render.gzip) { await this.gzipMiddleware(req, res) } // If base in req.url, remove it for the middleware and vue-router @@ -95,10 +95,7 @@ export async function renderRoute (url, context = {}) { if (this._routerBaseSpecified) { HEAD += `` } - if (this.options.performance.prefetch) { - HEAD += context.renderResourceHints() - } - HEAD += context.renderStyles() + HEAD += context.renderResourceHints() + context.renderStyles() APP += `` APP += context.renderScripts() const html = this.appTemplate({