webpack: Webpack 5 persistent cache + EnvironmentPlugin: environment variables changing doesn't affect cache.

Bug report

What is the current behavior?

Webpack 5 persistent cache + EnvironmentPlugin: environment variables changing doesn’t affect cache.

If the current behavior is a bug, please provide the steps to reproduce.

  • make webpack config with persistent cache and EnvironmentPlugin
  • build code, for example, with env variable TEST_VAR=1, output code will contain value 1
  • next build with TEST_VAR=2, output code will still contain value 1

What is the expected behavior?

Environment variable change will affect output code.

Other relevant information: webpack version: 5 Node.js version: 12 Operating System: macOS

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 16 (9 by maintainers)

Most upvoted comments

Let’s close in favor https://github.com/webpack/webpack/issues/10249 because duplicate, right now only one solution - cache.version