So I have this logs in my server.js file:
console.info("LOOGGGGGSSSS")
console.warn("LOOGGGGGSSSS")
console.log("LOOGGGGGSSSS")
console.error("LOOGGGGGSSSS")
My package.json has script:
"scripts": {
"dev": "next",
"start": "next start"
}
When I run server with npm run start all works correctly and I can see logs but with npm run dev no console.log() or console.error() works at all.
I tried with option quiet true and false but still not working:
const nextJsApp = next({dev, quiet: false}); // no logs in terminal
and
const nextJsApp = next({dev, quiet: true}); // still no logs in terminal
My next.config.js
require("dotenv").config();
const withCSS = require('@zeit/next-css');
const webpack = require('webpack');
const apiKey = JSON.stringify(process.env.SHOPIFY_API_KEY);
module.exports = withCSS({
webpack: (config) => {
const env = { SHOPIFY_API_KEY: apiKey };
config.plugins.push(new webpack.DefinePlugin(env));
return config;
},
});
nextcommand does not run yourserver.jsfile. If you want to runserver.js, runnode server.js. More information here: nextjs.org/docs/advanced-features/custom-server