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(
new HTMLPlugin({
template: this.options.appTemplatePath,
inject: this.options.render.ssr === false,
inject: this.options.ssr === false,
chunksSortMode: 'dependency'
})
)

View File

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

View File

@ -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)