Add production specific code

Add production specific check in Next.js

To add production specific code, you can add a small utility function for the same:

let isProduction = Boolean(process?.env.NODE_ENV === 'production')

export { isProduction }

Now use this while adding the check, for example:

import GoogleAnalytics from './google-analytics'

export default function App({ Component, pageProps }) {
  return (
        <meta name="description" content="" />
        <link rel="icon" href="/favicon.ico" />
      {isProduction && <GoogleAnalytics />}
      <Component {...pageProps} />