79484259

Date: 2025-03-04 16:14:13
Score: 0.5
Natty:
Report link

I was using the EsBuild instructions when I should have been using the Webpack instructions.

The webpack instructions work for the most part but the documentation is missing a variable declaration

module.exports = (config, options, context) => {
  config.plugins = config.plugins || []; // Add this line in. Without it, it'll be undefined
  config.mode = process.env.NODE_ENV || config.mode;
  config.plugins.push(new webpack.DefinePlugin(getClientEnvironment()));
  return config;
};

After following the Webpack instructions and adding the commented line above, I was able to get env vars working.

Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: Freigheist