deprecate performance key

This commit is contained in:
Pooya Parsa 2017-05-21 16:36:01 +04:30
parent f5541999fd
commit 1939e08cb2
3 changed files with 7 additions and 12 deletions

View File

@ -516,7 +516,6 @@ function createRenderer (bundle, manifest) {
cache: cacheConfig, cache: cacheConfig,
clientManifest: manifest, clientManifest: manifest,
runInNewContext: false, runInNewContext: false,
inject: false,
baseDir: this.options.dir baseDir: this.options.dir
}, this.options.build.ssr)) }, this.options.build.ssr))
this.renderToString = pify(this.renderer.renderToString) this.renderToString = pify(this.renderer.renderToString)

View File

@ -50,11 +50,10 @@ class Nuxt {
extendRoutes: null, extendRoutes: null,
scrollBehavior: null scrollBehavior: null
}, },
performance: { render: {
gzip: { gzip: {
threshold: 0 threshold: 0
}, }
prefetch: true
}, },
watchers: { watchers: {
webpack: {}, webpack: {},
@ -94,9 +93,9 @@ class Nuxt {
this.serveStaticNuxt = pify(serveStatic(resolve(this.dir, '.nuxt', 'dist'), { this.serveStaticNuxt = pify(serveStatic(resolve(this.dir, '.nuxt', 'dist'), {
maxAge: (this.dev ? 0 : '1y') // 1 year in production maxAge: (this.dev ? 0 : '1y') // 1 year in production
})) }))
// gzip for production // gzip middleware for production
if (!this.dev && this.options.performance.gzip) { if (!this.dev && this.options.render.gzip) {
this.gzipMiddleware = pify(compression(this.options.performance.gzip)) this.gzipMiddleware = pify(compression(this.options.render.gzip))
} }
// Add this.Server Class // Add this.Server Class
this.Server = Server this.Server = Server

View File

@ -30,7 +30,7 @@ export async function render (req, res) {
await this.webpackDevMiddleware(req, res) await this.webpackDevMiddleware(req, res)
await this.webpackHotMiddleware(req, res) await this.webpackHotMiddleware(req, res)
} }
if (!this.dev && this.options.performance.gzip) { if (!this.dev && this.options.render.gzip) {
await this.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
@ -95,10 +95,7 @@ export async function renderRoute (url, context = {}) {
if (this._routerBaseSpecified) { if (this._routerBaseSpecified) {
HEAD += `<base href="${this.options.router.base}">` HEAD += `<base href="${this.options.router.base}">`
} }
if (this.options.performance.prefetch) { HEAD += context.renderResourceHints() + context.renderStyles()
HEAD += context.renderResourceHints()
}
HEAD += context.renderStyles()
APP += `<script type="text/javascript">window.__NUXT__=${serialize(context.nuxt, { isJSON: true })}</script>` APP += `<script type="text/javascript">window.__NUXT__=${serialize(context.nuxt, { isJSON: true })}</script>`
APP += context.renderScripts() APP += context.renderScripts()
const html = this.appTemplate({ const html = this.appTemplate({