It seems that all console.log(...)
messages are not being output when running a production build. That is, if I run with npm run dev
, the messages log, but if I run npm run build, then npm start
the log messages do not show. I do get thrown errors but not the logs.
Is there some new setting I'm missing?
Here is what I mean (this is a server component)
import Image from 'next/image'
import styles from './page.module.css'
export default function Home() {
console.log("Home page");
return (
<main className={styles.main}>
<div className={styles.description}>
..
Here is the file in the GitHub repo that I build to show this.
https://github.com/pkellner/nextjs-13-prob1/blob/main/my-app1/app/page.tsx
I think how this page function don't need dynamic content, content that change every call, just the Image function, the nextjs builder runs and mount html structure once, and the Home function of the page is called at build time and after this the server just serve the static html created. Maybe if you create a dynamic function that need be rendered at serverside every call, the nextjs will leave this function running at serverside withouth just reading in build time, like using the "params", external content, http headers or something like this. The npm run dev will always reacreate the page every call to ensure your changes will be displayed, showing the stout (console.log of the serverside). But i'm not sure if that's the answer.