Skip to content

Commit c4c0921

Browse files
authored
Merge branch 'master' into fix-link-paths
2 parents e4f752f + 99cfb49 commit c4c0921

File tree

13 files changed

+176
-53
lines changed

13 files changed

+176
-53
lines changed

components/footer/footer.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export default (props) => {
1212
<section className="footer__left">
1313
<Link className="footer__link" to="/guides/get-started">Get Started</Link>
1414
<Link className="footer__link" to="/organization">Organization</Link>
15-
<Link className="footer__link" to="/contribute">Contribute</Link>
15+
<Link className="footer__link" to="/support">Support</Link>
1616
<Link className="footer__link" to="/guides/why-webpack#comparison">Comparison</Link>
1717
</section>
1818

@@ -24,7 +24,7 @@ export default (props) => {
2424

2525
<section className="footer__right">
2626
<Link className="footer__link" to="/branding">Branding</Link>
27-
<Link className="footer__link" to="//gitter.im/webpack/webpack">Support</Link>
27+
<Link className="footer__link" to="//gitter.im/webpack/webpack">Gitter</Link>
2828
<Link className="footer__link" to="https://github.com/webpack/webpack/releases">Changelog</Link>
2929
<Link className="footer__link" to="/license">License</Link>
3030
<CC />

content/configuration/dev-server.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ contributors:
1010

1111
webpack-dev-server can be used to quickly develop an application. See the ["How to Develop?"](/guides/development) to get started.
1212

13-
This page describes the options that effect the behavior of webpack-dev-server (short: dev-server).
13+
This page describes the options that affect the behavior of webpack-dev-server (short: dev-server).
1414

1515
T> Options that are compatible with [webpack-dev-middleware](https://github.com/webpack/webpack-dev-middleware) have 🔑 next to them.
1616

@@ -132,7 +132,7 @@ headers: {
132132

133133
`boolean` `object`
134134

135-
When using the [HTML5 History API](https://developer.mozilla.org/en-US/docs/Web/API/History), the `index.html` page will likely have be served in place of any `404` responses. Enable this by passing:
135+
When using the [HTML5 History API](https://developer.mozilla.org/en-US/docs/Web/API/History), the `index.html` page will likely have to be served in place of any `404` responses. Enable this by passing:
136136

137137
```js
138138
historyApiFallback: true

content/configuration/entry-context.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ By default the current directory is used, but it's recommended to pass a value i
2525

2626
## `entry`
2727

28-
`string | [string] | object { <key>: string | [string] }`
28+
`string | [string] | object { <key>: string | [string] } | function: () => string`
2929

3030
The point or points to enter the application. At this point the application starts executing. If an array is passed all items will be executed.
3131

@@ -41,4 +41,16 @@ entry: {
4141
}
4242
```
4343

44+
Dynamically entry.
45+
46+
```js
47+
entry: () => './demo'
48+
```
49+
50+
or
51+
52+
```js
53+
entry: () => new Promise((resolve) => resolve('./demo'))
54+
```
55+
4456
When combining with the [`output.library`](/configuration/output#output-library) option: If an array is passed only the last item is exported.

content/configuration/externals.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ contributors:
77
- pksjce
88
---
99

10-
`externals` configuration in webpack provides a way of not including a dependency in the bundle. Instead the created bundle relies on that dependency to be present in the consumers environment.
11-
This typically applies to library developers though application developers can make good use of this feature too.
10+
`externals` configuration in webpack provides a way of not including a dependency in the bundle. Instead, the created bundle relies on that dependency to be present in the consumer's environment.
11+
This typically applies to library developers, though application developers can make good use of this feature as well.
1212

1313
## `externals`
1414

content/contribute.md

Lines changed: 0 additions & 17 deletions
This file was deleted.

content/development/index.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
---
22
title: Development
3+
contributors:
4+
- rouzbeh84
35
---
46

5-
These guides cover what you need to know in order to develop webpack. WIP!
7+
These guides cover what you need to know in order to develop webpack.
8+
9+
* [Release Process](./release-process)
10+
* [Plugin Patterns](./plugin-patterns)
11+
* [How To Write A Plugin](./how-to-write-a-plugin)
12+
* [How To Write A Loader](./how-to-write-a-loader)

content/guides/get-started.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -92,16 +92,16 @@ function component () {
9292
We also need to change `index.html` to expect a single bundled js file.
9393

9494
```diff
95-
<html>
96-
<head>
97-
<title>webpack 2 demo</title>
98-
- <script src="https://unpkg.com/[email protected]"></script>
99-
</head>
100-
<body>
101-
- <script src="app/index.js"></script>
102-
+ <script src="dist/bundle.js"></script>
103-
</body>
104-
</html>
95+
<html>
96+
<head>
97+
<title>webpack 2 demo</title>
98+
- <script src="https://unpkg.com/[email protected]"></script>
99+
</head>
100+
<body>
101+
- <script src="app/index.js"></script>
102+
+ <script src="dist/bundle.js"></script>
103+
</body>
104+
</html>
105105
```
106106

107107
Here, `index.js` explicitly requires `lodash` to be present, and binds it as `_` (no global scope pollution).

content/plugins/commons-chunk-plugin.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ Hint: In combination with long term caching you may need to use the [`ChunkManif
110110
111111
### Move common modules into the parent chunk
112112
113-
With Code Splitting multiple child chunks of a chunk can have common modules. You can move these common modules into the parent (This reduces overall size, but has a negative effect on the initial load time. It can be useful if it is expected that a user need to download many sibling chunks).
113+
With [Code Splitting](/guides/code-splitting) multiple child chunks of an entry chunk can have common dependencies. To prevent duplication these can be moved into the parent. This reduces overall size, but does have a negative effect on the initial load time. If it is expected that users will need to download many sibling chunks, i.e. children of the entry chunk, then this should improve load time overall.
114114
115115
```javascript
116116
new webpack.optimize.CommonsChunkPlugin({

content/plugins/define-plugin.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
---
22
title: DefinePlugin
3-
contributurs:
3+
contributors:
44
- simon04
5+
- rouzbeh84
56
---
67

78
``` javascript
89
new webpack.DefinePlugin(definitions)
910
```
1011

11-
The `DefinePlugin` allows you to create global constants which can be configured at **compile** time. This can be useful for allowing different behaviour between development builds and release builds. For example, you might use a global constant to determine whether logging takes place; perhaps you perform logging in your development build but not in the release build. That's the sort of scenario the `DefinePlugin` facilitates.
12+
The `DefinePlugin` allows you to create global constants which can be configured at **compile** time. This can be useful for allowing different behavior between development builds and release builds. If you perform logging in your development build but not in the release build you might use a global constant to determine whether logging takes place. That's where `DefinePlugin` shines, set it and forget it rules for development and release builds.
1213

1314
**Example:**
1415

@@ -27,7 +28,7 @@ console.log("Running App version " + VERSION);
2728
if(!BROWSER_SUPPORTS_HTML5) require("html5shiv");
2829
```
2930

30-
T> Note that because the plugin does a direct text replacement, the value given to it must include actual quotes inside of the string itself. Typically, this is done either with alternate quotes, such as `'"production"'`, or by using `JSON.stringify('production')`.
31+
T> Note that because the plugin does a direct text replacement, the value given to it must include **actual quotes** inside of the string itself. Typically, this is done either with either alternate quotes, such as `'"production"'`, or by using `JSON.stringify('production')`.
3132

3233
Each key passed into `DefinePlugin` is an identifier or multiple identifiers joined with `.`.
3334

@@ -36,7 +37,7 @@ Each key passed into `DefinePlugin` is an identifier or multiple identifiers joi
3637
* If the value is an object all keys are defined the same way.
3738
* If you prefix `typeof` to the key, it's only defined for typeof calls.
3839

39-
The values will be inlined into the code which allows a minification pass to remove the redundant conditional.
40+
The values will be inlined into the code allowing a minification pass to remove the redundant conditional.
4041

4142
**Example:**
4243

@@ -47,7 +48,8 @@ if (!PRODUCTION) {
4748
if (PRODUCTION) {
4849
console.log('Production log')
4950
}
50-
`````
51+
```
52+
5153
After passing through webpack with no minification results in:
5254

5355
``` javascript
@@ -66,6 +68,7 @@ console.log('Production log')
6668
```
6769

6870
## Use Case: Feature Flags
71+
6972
Enable/disable features in production/development build using [feature flags](https://en.wikipedia.org/wiki/Feature_toggle).
7073

7174
```javascript
@@ -76,6 +79,7 @@ new webpack.DefinePlugin({
7679
```
7780

7881
## Use Case: Service URLs
82+
7983
Use a different service URL in production/development builds:
8084

8185
```javascript

content/plugins/environment-plugin.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,14 @@ title: EnvironmentPlugin
33
contributors:
44
- simon04
55
- einarlove
6+
- rouzbeh84
67
---
78

8-
The `EnvironmentPlugin` is a shorthand for using the [`DefinePlugin`](/plugins/define-plugin) on [`process.env`](https://nodejs.org/api/process.html#process_process_env) keys.
9+
The `EnvironmentPlugin` is shorthand for using the [`DefinePlugin`](/plugins/define-plugin) on [`process.env`](https://nodejs.org/api/process.html#process_process_env) keys.
910

1011
## Usage
1112

12-
The `EnvironmentPlugin` accepts either an array of keys.
13+
The `EnvironmentPlugin` accepts either an array of keys or an object mapping its keys to their default values.
1314

1415
```javascript
1516
new webpack.EnvironmentPlugin(['NODE_ENV', 'DEBUG'])
@@ -30,7 +31,7 @@ T> Not specifying the environment variable raises an "`EnvironmentPlugin` - `${k
3031

3132
Alternatively, the `EnvironmentPlugin` supports an object, which maps keys to their default values. The default value for a key is taken if the key is undefined in `process.env`.
3233

33-
```js
34+
```javascript
3435
new webpack.EnvironmentPlugin({
3536
NODE_ENV: 'development', // use 'development' unless process.env.NODE_ENV is defined
3637
DEBUG: false
@@ -47,7 +48,7 @@ T> To specify an unset default value, use `null` instead of `undefined`.
4748

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

50-
```js
51+
```javascript
5152
if (process.env.NODE_ENV === 'production') {
5253
console.log('Welcome to production');
5354
}
@@ -58,7 +59,7 @@ if (process.env.DEBUG) {
5859

5960
When executing `NODE_ENV=production webpack` in the terminal to build, `entry.js` becomes this:
6061

61-
```js
62+
```javascript
6263
if ('production' === 'production') { // <-- 'production' from NODE_ENV is taken
6364
console.log('Welcome to production');
6465
}
@@ -69,11 +70,11 @@ if (false) { // <-- default value is taken
6970

7071
Running `DEBUG=false webpack` yields:
7172

72-
```js
73+
```javascript
7374
if ('development' === 'production') { // <-- default value is taken
7475
console.log('Welcome to production');
7576
}
7677
if ('false') { // <-- 'false' from DEBUG is taken
7778
console.log('Debugging output');
7879
}
79-
```
80+
```

content/plugins/index.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,23 @@ title: Plugins
33
contributors:
44
- simon04
55
- gonzoyumo
6+
- rouzbeh84
67
---
78

89
webpack has a rich plugin interface. Most of the features within webpack itself use this plugin interface. This makes webpack **flexible**.
910

1011
|Name|Description|
1112
|:--:|:----------|
1213
|[`CommonsChunkPlugin`](/plugins/commons-chunk-plugin)|Generates chunks of common modules shared between entry points and splits them into separate bundles, e.g., `1vendor.bundle.js` && `app.bundle.js`|
13-
|[`ExtractTextWebpackPlugin`](/plugins/extract-text-webpack-plugin)|Extracts Text (CSS) from your bundles into a separate file (app.bundle.css)|
1414
|[`ComponentWebpackPlugin`](/plugins/component-webpack-plugin)|Use components with webpack|
1515
|[`CompressionWebpackPlugin`](/plugins/compression-webpack-plugin)|Prepare compressed versions of assets to serve them with Content-Encoding|
16-
|[`I18nWebpackPlugin`](/plugins/i18n-webpack-plugin)|Adds i18n support to your bundles|
16+
|[`DefinePlugin`](/plugins/define-plugin)|Allows global constants configured at compile time, useful for allowing different behavior between dev/release builds|
17+
|[`EnvironmentPlugin`](/plugins/environment-plugin)|Shorthand for using the [`DefinePlugin`](./define-plugin) on `process.env` keys.|
18+
|[`ExtractTextWebpackPlugin`](/plugins/extract-text-webpack-plugin)|Extracts Text (CSS) from your bundles into a separate file (app.bundle.css)|
1719
|[`HtmlWebpackPlugin`](/plugins/html-webpack-plugin)| Simplifies creation of HTML files (`index.html`) to serve your bundles|
20+
|[`I18nWebpackPlugin`](/plugins/i18n-webpack-plugin)|Adds i18n support to your bundles|
21+
|[`LimitChunkCountPlugin`](/plugins/limit-chunk-count-plugin)| Set min/max limits for chunking to fine tune and control chunking|
1822
|[`NormalModuleReplacementPlugin`](/plugins/normal-module-replacement-plugin)|Replaces resource that matches a regexp|
1923

20-
2124
![Awesome](../assets/awesome-badge.svg)
2225
For more third-party plugins, see the list from [awesome-webpack](https://github.com/webpack-contrib/awesome-webpack#webpack-plugins).

0 commit comments

Comments
 (0)