Remove cache option, use build.ssr.cache instead

This commit is contained in:
Sébastien Chopin 2017-05-21 15:13:19 +02:00
parent 054df82200
commit 14c3c07d57
7 changed files with 15 additions and 14 deletions

View File

@ -1,3 +1,10 @@
module.exports = {
cache: true
build: {
ssr: {
cache: require('lru-cache')({
max: 1000,
maxAge: 1000 * 60 * 15
})
}
}
}

View File

@ -1,6 +1,7 @@
{
"name": "nuxt-cached-components",
"dependencies": {
"lru-cache": "^4.0.2",
"nuxt": "latest"
},
"scripts": {

View File

@ -0,0 +1,5 @@
module.exports = {
generate: {
minify: false
}
}

View File

@ -490,16 +490,7 @@ function webpackRunServer () {
function createRenderer (bundle, manifest) {
// Create bundle renderer to give a fresh context for every request
let cacheConfig = false
if (this.options.cache) {
this.options.cache = (typeof this.options.cache !== 'object' ? {} : this.options.cache)
cacheConfig = require('lru-cache')(_.defaults(this.options.cache, {
max: 1000,
maxAge: 1000 * 60 * 15
}))
}
this.renderer = createBundleRenderer(bundle, Object.assign({
cache: cacheConfig,
clientManifest: manifest,
runInNewContext: false,
inject: false,

View File

@ -30,7 +30,6 @@ class Nuxt {
layouts: {},
serverMiddleware: [],
ErrorPage: null,
cache: false,
loading: {
color: 'black',
failedColor: 'red',

View File

@ -59,7 +59,6 @@
"babel-preset-es2015": "^6.24.1",
"babel-preset-vue-app": "^1.2.0",
"chokidar": "^1.7.0",
"co": "^4.6.0",
"compression": "^1.6.2",
"connect": "^3.6.2",
"css-loader": "^0.28.1",
@ -73,7 +72,6 @@
"html-minifier": "^3.5.0",
"html-webpack-plugin": "^2.28.0",
"lodash": "^4.17.4",
"lru-cache": "^4.0.2",
"memory-fs": "^0.4.1",
"offline-plugin": "^4.7.0",
"opencollective": "^1.0.3",

View File

@ -3878,7 +3878,7 @@ lru-cache@^3.2.0:
dependencies:
pseudomap "^1.0.1"
lru-cache@^4.0.0, lru-cache@^4.0.1, lru-cache@^4.0.2:
lru-cache@^4.0.0, lru-cache@^4.0.1:
version "4.0.2"
resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-4.0.2.tgz#1d17679c069cda5d040991a09dbc2c0db377e55e"
dependencies: