Skip to content

[BUG][Webpack] process.env is no longer parsed after v22.2.2 #34279

@speter2

Description

@speter2

Current Behavior

These changes broke the parsing of process.env: #30826
The values are loaded during build time, which can be checked by console.log inside webpack.config, but whatever solution you try to pass them forward, they are lost inside the built app.
If you console.log the process.env global variable, you always get an empty object, while before this version this always yielded the variables prefixed by NX_PUBLIC_

Expected Behavior

You can use process.env to see and access your environment variables

GitHub Repo

No response

Steps to Reproduce

  1. create a .env file and put some variables inside
  2. update to v22.2.2
  3. verify that inside the app process.env no longer works

Nx Report

Node           : 24.13.0
OS             : win32-x64
Native Target  : x86_64-windows
pnpm           : 10.28.2

nx                     : 22.2.7
@nx/js                 : 22.2.7
@nx/jest               : 22.2.7
@nx/eslint             : 22.2.7
@nx/workspace          : 22.2.7
@nx/cypress            : 22.2.7
@nx/devkit             : 22.2.7
@nx/eslint-plugin      : 22.2.7
@nx/module-federation  : 22.2.7
@nx/react              : 22.2.7
@nx/rollup             : 22.2.7
@nx/vite               : 22.2.7
@nx/vitest             : 22.2.7
@nx/web                : 22.2.7
@nx/webpack            : 22.2.7
typescript             : 5.9.3
---------------------------------------
Cache Usage: 0.00 B / 47.15 GB

Failure Logs

Package Manager Version

No response

Operating System

  • macOS
  • Linux
  • Windows
  • Other (Please specify)

Additional Information

No response

Metadata

Metadata

Assignees

Labels

outdatedpriority: highHigh Priority (important issues which affect many people severely)scope: bundlersIssues related to webpack, rolluptype: bug

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions