Skip to content

Commit 6fe45e5

Browse files
authored
docs(plugins): update EnvironmentPlugin warning (#7461)
1 parent 5168297 commit 6fe45e5

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

src/content/plugins/environment-plugin.mdx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ new webpack.DefinePlugin({
2727
});
2828
```
2929

30-
T> Not specifying the environment variable raises an "`EnvironmentPlugin` - `${key}` environment variable is undefined" error.
30+
W> `EnvironmentPlugin` checks `process.env` for the specified variable. If it’s missing, it searches for a default value provided in the configuration. If neither the environment variable nor the default value is defined, an error will be thrown: **"`EnvironmentPlugin` - `${key}` environment variable is `undefined`"**.
3131

3232
## Usage with default values
3333

@@ -46,8 +46,6 @@ T> Unlike [`DefinePlugin`](/plugins/define-plugin), default values are applied t
4646

4747
T> Default values of `null` and `undefined` behave differently. Use `undefined` for variables that _must_ be provided during bundling, or `null` if they are optional.
4848

49-
W> If an environment variable is not found during bundling and no default value was provided, webpack will throw an error instead of a warning.
50-
5149
**Example:**
5250

5351
Let's investigate the result when running the previous `EnvironmentPlugin` configuration on a test file `entry.js`:

0 commit comments

Comments
 (0)