Tengo un archivo nextjs _document donde necesito agregar scripts basados en variables env... (dev, stage, production) ¿Cómo puedo consolar iniciar sesión en _document y depurar, así como cargar scripts basados en variables env?
/* eslint-disable react/display-name */ import Document, { Head, Html, Main, NextScript } from 'next/document'; import { ReactElement } from 'react'; import { ServerStyleSheet } from 'styled-components'; export default class CustomDocument extends Document<{ styleTags: ReactElement[]; }> { static getInitialProps({ renderPage }) { const sheet = new ServerStyleSheet(); console.log('process env', process.env); const page = renderPage(App => props => sheet.collectStyles(<App {...props} />)); const styleTags = sheet.getStyleElement(); return { ...page, styleTags }; } render() { console.log('Propsssss', this.props); return ( <Html> <Head> {this.props.styleTags} </Head> <body> <Main /> <NextScript /> </body> </Html> ); } }