feat: top level ssr option

This commit is contained in:
Pooya Parsa 2017-07-05 02:20:43 +04:30
parent 0831f9c5bc
commit 9475e1c431
3 changed files with 5 additions and 10 deletions

View File

@ -64,7 +64,7 @@ export default function webpackClientConfig () {
config.plugins.push( config.plugins.push(
new HTMLPlugin({ new HTMLPlugin({
template: this.options.appTemplatePath, template: this.options.appTemplatePath,
inject: this.options.render.ssr === false, inject: this.options.ssr === false,
chunksSortMode: 'dependency' chunksSortMode: 'dependency'
}) })
) )

View File

@ -130,8 +130,9 @@ export const defaultOptions = {
scrollBehavior: null, scrollBehavior: null,
fallback: false fallback: false
}, },
render: {
ssr: {}, ssr: {},
render: {
bundleRenderer: {},
resourceHints: true, resourceHints: true,
http2: { http2: {
push: false push: false

View File

@ -121,7 +121,7 @@ export default class Renderer extends Tapable {
} }
get noSSR () { get noSSR () {
return this.options.render.ssr === false return this.options.ssr === false
} }
createRenderer () { createRenderer () {
@ -140,13 +140,7 @@ export default class Renderer extends Tapable {
clientManifest: this.resources.clientManifest, clientManifest: this.resources.clientManifest,
runInNewContext: false, runInNewContext: false,
basedir: this.options.rootDir basedir: this.options.rootDir
}, this.options.render.ssr, this.options.build.ssr)) }, this.options.render.bundleRenderer))
/* 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!')
}
// Promisify renderToString // Promisify renderToString
this.bundleRenderer.renderToString = pify(this.bundleRenderer.renderToString) this.bundleRenderer.renderToString = pify(this.bundleRenderer.renderToString)