From 9475e1c431a2d3b1ce86d77c3193a780de1eb249 Mon Sep 17 00:00:00 2001 From: Pooya Parsa Date: Wed, 5 Jul 2017 02:20:43 +0430 Subject: [PATCH] feat: top level ssr option --- lib/builder/webpack/client.config.js | 2 +- lib/core/options.js | 3 ++- lib/core/renderer.js | 10 ++-------- 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/lib/builder/webpack/client.config.js b/lib/builder/webpack/client.config.js index 2cf2d1d65b..9e9834fdfd 100644 --- a/lib/builder/webpack/client.config.js +++ b/lib/builder/webpack/client.config.js @@ -64,7 +64,7 @@ export default function webpackClientConfig () { config.plugins.push( new HTMLPlugin({ template: this.options.appTemplatePath, - inject: this.options.render.ssr === false, + inject: this.options.ssr === false, chunksSortMode: 'dependency' }) ) diff --git a/lib/core/options.js b/lib/core/options.js index ee7ada1187..c89b9ddea0 100755 --- a/lib/core/options.js +++ b/lib/core/options.js @@ -130,8 +130,9 @@ export const defaultOptions = { scrollBehavior: null, fallback: false }, + ssr: {}, render: { - ssr: {}, + bundleRenderer: {}, resourceHints: true, http2: { push: false diff --git a/lib/core/renderer.js b/lib/core/renderer.js index 36338fa055..2e36ed2f20 100644 --- a/lib/core/renderer.js +++ b/lib/core/renderer.js @@ -121,7 +121,7 @@ export default class Renderer extends Tapable { } get noSSR () { - return this.options.render.ssr === false + return this.options.ssr === false } createRenderer () { @@ -140,13 +140,7 @@ export default class Renderer extends Tapable { clientManifest: this.resources.clientManifest, runInNewContext: false, basedir: this.options.rootDir - }, this.options.render.ssr, this.options.build.ssr)) - - /* istanbul ignore if */ - if (this.options.build.ssr) { - // eslint-disable-next-line no-console - console.warn('[nuxt] `build.ssr` is deprecated and will be removed in 1.0 release, please use `render.ssr` instead!') - } + }, this.options.render.bundleRenderer)) // Promisify renderToString this.bundleRenderer.renderToString = pify(this.bundleRenderer.renderToString)