rsnext/packages/next/build/webpack
Gal Schlezinger e69500462d
middlewares: limit process.env to inferred usage (#33186)
Production middlewares will only expose env vars that are statically analyzable, as mentioned here: https://nextjs.org/docs/api-reference/next/server#how-do-i-access-environment-variables

This creates some incompatibility with `next dev` and `next start`, where all `process.env` data is shared and can lead to unexpected behavior in runtime.

This PR fixes it by limiting the data in `process.env` with the inferred env vars from the code usage. I believe the test speaks for itself 🕺 

<!--
## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `yarn lint`
-->
2022-01-12 13:09:24 +00:00
..
config Move resolve-url-loader into Next.js (#32932) 2022-01-02 16:16:17 -06:00
loaders Fix issue with escape-string-regexp in IE11 (#32708) 2022-01-03 11:41:50 -06:00
plugins middlewares: limit process.env to inferred usage (#33186) 2022-01-12 13:09:24 +00:00
require-hook.ts Pre-compile more dependencies continued (#32679) 2021-12-21 16:13:45 +01:00
stringify-request.ts Update loader-utils (#30743) 2021-11-02 16:13:15 +01:00