update render references

This commit is contained in:
Pooya Parsa 2017-06-14 00:53:02 +04:30
parent b79f845842
commit 5768ef5092

View File

@ -63,7 +63,7 @@ export default class Renderer extends Tapable {
await this.nuxt.builder.webpackHotMiddleware(req, res) await this.nuxt.builder.webpackHotMiddleware(req, res)
} }
if (!this.options.dev && this.options.render.gzip) { if (!this.options.dev && this.options.render.gzip) {
await this.nuxt.gzipMiddleware(req, res) await this.gzipMiddleware(req, res)
} }
// If base in req.url, remove it for the middleware and vue-router // If base in req.url, remove it for the middleware and vue-router
if (this.options.router.base !== '/' && req.url.indexOf(this.options.router.base) === 0) { if (this.options.router.base !== '/' && req.url.indexOf(this.options.router.base) === 0) {
@ -71,12 +71,12 @@ export default class Renderer extends Tapable {
req.url = req.url.replace(this.options.router.base, '/') req.url = req.url.replace(this.options.router.base, '/')
} }
// Serve static/ files // Serve static/ files
await this.nuxt.serveStatic(req, res) await this.serveStatic(req, res)
// Serve .nuxt/dist/ files (only for production) // Serve .nuxt/dist/ files (only for production)
if (!this.options.dev && req.url.indexOf(this.options.build.publicPath) === 0) { if (!this.options.dev && req.url.indexOf(this.options.build.publicPath) === 0) {
const url = req.url const url = req.url
req.url = req.url.replace(this.options.build.publicPath, '/') req.url = req.url.replace(this.options.build.publicPath, '/')
await this.nuxt.serveStaticNuxt(req, res) await this.serveStaticNuxt(req, res)
/* istanbul ignore next */ /* istanbul ignore next */
req.url = url req.url = url
} }
@ -127,7 +127,7 @@ export default class Renderer extends Tapable {
console.error(err) // eslint-disable-line no-console console.error(err) // eslint-disable-line no-console
return err return err
} }
const html = this.nuxt.errorTemplate({ const html = this.errorTemplate({
/* istanbul ignore if */ /* istanbul ignore if */
error: err, error: err,
stack: ansiHTML(encodeHtml(err.stack)) stack: ansiHTML(encodeHtml(err.stack))