Last active
May 26, 2019 21:53
-
-
Save themakunga/feea3c905b65d873914f99803a674985 to your computer and use it in GitHub Desktop.
WA en js para los problemas de nuxt con memoria Heap abajo sale como dejarlo en la seccion scripts de package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"scripts": { | |
"serve": "node --max-old-space-size=3072 ./workAround.js", | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { Nuxt, Builder } = require('nuxt'); | |
const bodyParser = require('body-parser'); | |
const session = require('express-session'); | |
const app = require('express')(); | |
// Body parser, to access req.body | |
app.use(bodyParser.json()); | |
// Sessions to create req.session | |
app.use(session({ | |
secret: 'super-secret-key', | |
resave: false, | |
saveUninitialized: false, | |
cookie: { maxAge: 60000 }, | |
})); | |
// We instantiate Nuxt.js with the options | |
const isProd = process.env.NODE_ENV === 'production'; | |
const config = require('./nuxt.config.js'); | |
config.dev = !isProd; | |
const nuxt = new Nuxt(config); | |
// No build in production | |
const promise = (isProd ? Promise.resolve() : new Builder(nuxt).build()); | |
promise.then(() => { | |
app.use(nuxt.render); | |
app.listen(3000); | |
console.log('Server is listening on http://localhost:3000'); // eslint-disable-line no-console | |
}) | |
.catch((error) => { | |
console.error(error); // eslint-disable-line no-console | |
process.exit(1); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment