Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

197
Vistas
process.env throws Uncaught ReferenceError but process.env.NODE_ENV does not

In my client-side javascript file if I run the following I get no error:

console.log(process.env.NODE_ENV); // outputs development or production

But if I run the following then I get an error:

console.log(process.env) // Uncaught ReferenceError: process is not defined

Why is this happening? Using Webpack 5 for bundling.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Because you're using a bundler that replaces process.env.NODE_ENV with another value. For Webpack, it's DefinePlugin doing the dirty work (and setting the Webpack --mode option automatically adds the plugin); for e.g. esbuild it's define.

Your resulting bundled JavaScript will not have process.env.NODE_ENV at all, just a static string "production" or "development". However, just process.env will not be replaced (unless configured so), so you're getting a reference error.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda