React + webpack: ‘process.env’ is undefined

In your webpack config, there are two options that can affect process.env:

  • When you specify config.target (see config.target)
  • When you define the process.env variable via DefinePlugin

Looking at your code, it looks like process.env might be undefined when both options.prerender and options.minimize are false.

You could fix this by always using an environment that defines process.env (ex: node), or by using DefinePlugin to assign a default value to the variable yourself.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)