Skip to content

Instantly share code, notes, and snippets.

@themakunga
Last active May 26, 2019 21:53
Show Gist options
  • Save themakunga/feea3c905b65d873914f99803a674985 to your computer and use it in GitHub Desktop.
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
{
"scripts": {
"serve": "node --max-old-space-size=3072 ./workAround.js",
}
}
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