refactor: renderToString now returns a Promise if no callback is passed

This commit is contained in:
Clark Du 2017-10-16 11:29:09 +08:00 committed by Sebastien Chopin
parent 7df46279bf
commit c659f9bce4

View File

@ -3,7 +3,6 @@ import serialize from 'serialize-javascript'
import generateETag from 'etag' import generateETag from 'etag'
import fresh from 'fresh' import fresh from 'fresh'
import Tapable from 'tappable' import Tapable from 'tappable'
import pify from 'pify'
import serveStatic from 'serve-static' import serveStatic from 'serve-static'
import compression from 'compression' import compression from 'compression'
import _ from 'lodash' import _ from 'lodash'
@ -167,9 +166,6 @@ export default class Renderer extends Tapable {
runInNewContext: false, runInNewContext: false,
basedir: this.options.rootDir basedir: this.options.rootDir
}, this.options.render.bundleRenderer)) }, this.options.render.bundleRenderer))
// Promisify renderToString
this.bundleRenderer.renderToString = pify(this.bundleRenderer.renderToString)
} }
useMiddleware (m) { useMiddleware (m) {