Skip to content

Commit c13e3b1

Browse files
committed
Add environment-plugin documentation
Source: written by myself
1 parent 2f0be15 commit c13e3b1

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

content/plugins/environment-plugin.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
title: environment-plugin
3+
contributors:
4+
- simon04
5+
---
6+
7+
The environment-plugin is a shorthand for using the [define-plugin](/plugins/define-plugin)
8+
on [`process.env`](https://nodejs.org/api/process.html#process_process_env) keys.
9+
10+
**Example:**
11+
12+
```javascript
13+
new webpack.EnvironmentPlugin([
14+
'NODE_ENV'
15+
])
16+
```
17+
18+
This is equivalent to the following define-plugin application:
19+
20+
```javascript
21+
new webpack.DefinePlugin({
22+
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV)
23+
})
24+
```

0 commit comments

Comments
 (0)