Skip to content

Commit 24a3e39

Browse files
committed
Merge branch 'master' into rebuild
2 parents 05ba76f + 0644567 commit 24a3e39

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+995
-289
lines changed

.github/CONTRIBUTING.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Start by ensuring you have Node installed and forking the repository:
1616

1717
Once you are in the project directory, run the following commands:
1818

19-
- `npm install` to pull all dependencies.
19+
- `npm install` to pull all dependencies. Make sure to check notes below if you prefer Yarn.
2020
- `npm run build` to create a production version of the site.
2121
- `npm start` to develop on a local webpack-dev-server: [localhost:3000][3].
2222
- `npm run fetch` to retrieve external documentation/data.
@@ -30,6 +30,8 @@ See the `package.json` for the full list of `scripts`.
3030
3131
> Note that a __Python version between v2.5.0 and 3.0.0__ is required for the [proselint][12] dependency.
3232
33+
> Although __Yarn__ is not required to work with webpack docs, the core team is using it more extensively. If you prefer to use Yarn make sure you [got it installed][13] and run `yarn` to pull all dependencies, `yarn build` to build the project, or `yarn start` to start development server.
34+
3335
> On Debian and Ubuntu operating systems you may have to use `node >= 7.0.0` to avoid build errors with `node-sass`. Please note that we don't officially support building on these systems.
3436
3537

@@ -59,7 +61,7 @@ Making a branch in your fork for your contribution is helpful in the following w
5961

6062
## Committing Your Changes
6163

62-
Please follow the [conventionalcommits][10] specification. For example, for documentation
64+
Please follow the [conventional commits][10] specification. For example, for documentation
6365
changes, a short commit message may resemble the following:
6466

6567
``` md
@@ -125,3 +127,4 @@ any time spent fixing typos or clarifying sections in the documentation.
125127
[10]: http://conventionalcommits.org/
126128
[11]: https://github.com/conventional-changelog/standard-version
127129
[12]: https://github.com/amperser/proselint
130+
[13]: https://yarnpkg.com/lang/en/docs/install
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
name: Documentation request
3+
about: Create a documentation request for a new feature or functionality change.
4+
---
5+
6+
**Feature to document**
7+
8+
<!-- Name of the feature(s) and a link to related pull request of the feature implementation. -->
9+
10+
**Author(s)**
11+
12+
<!-- Mention feature author(s) in order to know who is assignable for review outside of the documentation team. -->
13+
14+
**Additional information**
15+
16+
<!-- Please provide any additional information that is required in order to document the feature in the best possible way or say N/A if linked PR has more than enough details. -->

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ src/**/_*.md
77
.DS_Store
88
npm-debug.log
99
yarn-error.log
10+
package-lock.json

.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
package-lock=false

.travis.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,7 @@ sudo: required
99
install:
1010
- yarn
1111
- sudo pip install proselint
12+
before_script:
13+
- source ./src/scripts/env.sh
1214
script:
1315
- bash ./src/scripts/deploy.sh

package.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
"clean": "rimraf ./dist src/content/**/_*.md src/**/_*.json",
2828
"start": "NODE_ENV=development webpack-dev-server --config webpack.dev.js --env.dev",
2929
"content": "node src/scripts/build-content-tree.js ./src/content ./src/_content.json",
30+
"build-test": "npm run build && http-server build/",
3031
"fetch": "sh src/scripts/fetch.sh",
3132
"prebuild": "npm run clean",
3233
"build": "npm run fetch && npm run content && NODE_ENV=production webpack --config webpack.prod.js && npm run sitemap && echo webpack.js.org > dist/CNAME",
@@ -40,6 +41,11 @@
4041
"serve": "npm run build && sirv start ./dist --port 4000",
4142
"deploy": "gh-pages -d dist"
4243
},
44+
"husky": {
45+
"hooks": {
46+
"pre-commit": "npm test"
47+
}
48+
},
4349
"devDependencies": {
4450
"@octokit/rest": "^15.2.6",
4551
"alex": "^5.1.0",
@@ -67,6 +73,11 @@
6773
"gh-pages": "^1.0.0",
6874
"html-webpack-plugin": "^2.30.1",
6975
"html-webpack-template": "^6.1.0",
76+
"github": "^10.0.0",
77+
"http-server": "^0.10.0",
78+
"husky": "^1.0.0-rc.8",
79+
"hyperlink": "^3.0.1",
80+
"loader-utils": "^1.1.0",
7081
"lodash": "^4.17.4",
7182
"markdownlint": "^0.6.0",
7283
"markdownlint-cli": "0.10.0",

src/components/Contributors/Contributors.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export default ({contributors}) => {
1414
<a key={ contributor }
1515
className="contributor"
1616
href={ `https://github.com/${contributor}` }>
17-
<img src={ `https://github.com/${contributor}.png?size=90` } />
17+
<img alt={ contributor } src={ `https://github.com/${contributor}.png?size=90` } />
1818
<span className="contributor__name"> {contributor}</span>
1919
</a>
2020
))

src/components/Dropdown/Dropdown.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export default class Dropdown extends React.Component {
2323
src={ LanguageIcon } />
2424
{/* Commented out until media breakpoints are in place
2525
<span>{ items[0].title }</span> */}
26-
<i className="dropdown__arrow" />
26+
<i aria-hidden="true" className="dropdown__arrow" />
2727

2828
<div className={ `dropdown__list ${activeMod}` }>
2929
<ul>

src/components/Markdown/Markdown.scss

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -118,13 +118,13 @@
118118
}
119119

120120
&.tip {
121-
background-color: #DCF2FD;
122-
color: #618ca0;
121+
background-color: #eaf8ff;
122+
color: #4e7182;
123123
}
124124

125125
&.warning {
126-
background-color: #fbedb7;
127-
color: #8c8466;
126+
background-color: #fdf5d8;
127+
color: #716b53;
128128
}
129129

130130
&.todo {
@@ -279,7 +279,7 @@
279279
margin: 0 2px;
280280
padding: 2px 6px;
281281
white-space: normal;
282-
background-color: transparentize(getColor(fiord), 0.94);
282+
background-color: transparentize(getColor(fiord), 0.95);
283283
border-radius: 3px;
284284
text-shadow: 0 1px 0 transparentize(getColor(white), 0.4);
285285
}

src/components/Markdown/prism-theme.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ pre[class*="lang-"] {
4141
.token.prolog,
4242
.token.doctype,
4343
.token.cdata {
44-
color: #77858c;
44+
color: #93a4ad;
4545
}
4646

4747
.token.punctuation {
@@ -71,7 +71,7 @@ pre[class*="lang-"] {
7171
.token.regex,
7272
.token.attr-value,
7373
.token.important {
74-
color: desaturate(#2dd271, 25%)
74+
color: desaturate(#2dd271, 23%)
7575
}
7676

7777
.token.inserted {

src/components/Navigation/Navigation.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,13 @@ export default class Navigation extends React.Component {
3131
title: 'GitHub Repository',
3232
url: 'https://github.com/webpack/webpack',
3333
className: 'navigation__item--icon',
34-
content: <i className="icon-github" />
34+
content: <i aria-hidden="true" className="icon-github" />
3535
},
3636
{
3737
title: 'Webpack on Stack Overflow',
3838
url: 'https://stackoverflow.com/questions/tagged/webpack',
3939
className: 'navigation__item--icon',
40-
content: <i className="icon-stack-overflow" />
40+
content: <i aria-hidden="true" className="icon-stack-overflow" />
4141
},
4242
{
4343
className: 'navigation__item--icon',

src/components/NotificationBar/NotificationBar.jsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,11 @@ class MessageBar extends React.Component {
2424
<a href="https://opencollective.com/webpack">open collective</a>!
2525
</p>
2626
{localStorageIsEnabled ? (
27-
<button className="notification-bar__close icon-cross" onClick={this.close.bind(this)} />
27+
<button
28+
aria-label="Dismiss"
29+
className="notification-bar__close icon-cross"
30+
onClick={this.close.bind(this)}
31+
/>
2832
) : null}
2933
</Container>
3034
</div>

src/components/Shield/Shield.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React from 'react';
22

33
export default props => (
4-
<img src={
4+
<img alt="webpack shield" src={
55
`https://img.shields.io/${props.content}.svg?label=${props.label}&style=flat-square&maxAge=3600`
66
} />
77
);

src/components/SplashViz/SplashVizSVG.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ module.exports = {
4545
<g transform="translate(342, 225)" stroke="#7E8C94" stroke-width="4">
4646
<path d="M499.558824,86.52 C499.558824,86.52 484.852941,81.02 439.908088,109.436667 C394.963235,137.853333 380.992647,164.436667 380.992647,164.436667" stroke-dasharray="7"></path>
4747
<path d="M499.558824,86.0616667 C499.558824,86.0616667 484.852941,91.5616667 439.908088,63.145 C394.963235,34.7283333 380.992647,8.145 380.992647,8.145" stroke-dasharray="7"></path>
48-
<path d="M0.477941176,170.395 C0.477941176,170.395 169.382939,98.895 447.847936,98.895" id="Shape_99_" stroke-dasharray="6"></path>
49-
<path d="M0.477941176,72.395 C0.477941176,72.395 169.382939,0.895 447.847936,0.895" id="Shape_99_" stroke-dasharray="6" transform="translate(224.162939, 36.645000) scale(1, -1) translate(-224.162939, -36.645000) "></path>
48+
<path d="M0.477941176,170.395 C0.477941176,170.395 169.382939,98.895 447.847936,98.895" stroke-dasharray="6"></path>
49+
<path d="M0.477941176,72.395 C0.477941176,72.395 169.382939,0.895 447.847936,0.895" stroke-dasharray="6" transform="translate(224.162939, 36.645000) scale(1, -1) translate(-224.162939, -36.645000) "></path>
5050
</g>
5151
<text font-family="'Source Sans Pro', sans-serif" font-size="18" font-weight="600" fill="#86A5BA">
5252
<tspan x="24.934" y="562">MODULES WITH DEPENDENCIES</tspan>

src/content/api/cli.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,8 @@ This will form the bundle with both the files as separate entry points.
9898

9999
### Common Options
100100

101+
W> Note that Command Line Interface has a higher precendence for the arguments you use it with than your configuration file. For instance, if you pass [`--mode="production"`](/concepts/mode/#usage) to webpack CLI and your configuration file uses `development`, `production` will be used.
102+
101103
**List all of the options available on the cli**
102104

103105
```bash
@@ -170,6 +172,7 @@ Parameter | Explanation | Input
170172
`--output-pathinfo` | Include a comment with the request for every dependency | boolean | false
171173
`--output-public-path` | The public path for the assets | string | /
172174
`--output-source-map-filename` | The output filename for the SourceMap | string | [name].map or [outputFilename].map
175+
`--build-delimiter` | Display custom text after build output | string | Default string is null. You could provide a string such as `=== Build done ===`
173176

174177

175178
#### Example Usage

src/content/api/compiler-hooks.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ Parameters: `compilation`
217217

218218
### `done`
219219

220-
`SyncHook`
220+
`AsyncSeriesHook`
221221

222222
Compilation has completed.
223223

src/content/concepts/index.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,11 @@ At its core, **webpack** is a _static module bundler_ for modern JavaScript appl
1919

2020
T> Learn more about JavaScript modules and webpack modules [here](/concepts/modules).
2121

22-
Since version 4, **webpack does not require a configuration file** to bundle your project, nevertheless it is [incredibly configurable](/configuration) to better fit your needs.
22+
Since version 4.0.0, **webpack does not require a configuration file** to bundle your project, nevertheless it is [incredibly configurable](/configuration) to better fit your needs.
2323

2424
To get started you only need to understand its **Core Concepts**:
2525

26+
2627
- Entry
2728
- Output
2829
- Loaders
@@ -79,7 +80,7 @@ Out of the box, webpack only understands JavaScript files. **Loaders** allow web
7980

8081
W> Note that the ability to `import` any type of module, e.g. `.css` files, is a feature specific to webpack and may not be supported by other bundlers or task runners. We feel this extension of the language is warranted as it allows developers to build a more accurate dependency graph.
8182

82-
At a high level, **loaders** have two purposes in your webpack configuration:
83+
At a high level, **loaders** have two properties in your webpack configuration:
8384

8485
1. The `test` property identifies which file or files should be transformed.
8586
2. The `use` property indicates which loader should be used to do the transforming.

src/content/concepts/mode.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ Providing the `mode` configuration option tells webpack to use its built-in opti
1010

1111
`string`
1212

13+
T> The default value for `mode` is `production`.
14+
1315
## Usage
1416

1517
Just provide the `mode` option in the config:
@@ -27,14 +29,16 @@ or pass it as a [CLI](/api/cli/) argument:
2729
webpack --mode=production
2830
```
2931

30-
If not set, webpack sets `production` as the default value for `mode`. The supported values for mode are:
32+
The following string values are supported:
3133

3234
Option | Description
3335
--------------------- | -----------------------
3436
`development` | Provides `process.env.NODE_ENV` with value `development`. Enables `NamedChunksPlugin` and `NamedModulesPlugin`.
3537
`production` | Provides `process.env.NODE_ENV` with value `production`. Enables `FlagDependencyUsagePlugin`, `FlagIncludedChunksPlugin`, `ModuleConcatenationPlugin`, `NoEmitOnErrorsPlugin`, `OccurrenceOrderPlugin`, `SideEffectsFlagPlugin` and `UglifyJsPlugin`.
3638
`none` | Opts out of any default optimization options
3739

40+
If not set, webpack sets `production` as the default value for `mode`. The supported values for mode are:
41+
3842
T> Please remember that setting `NODE_ENV` doesn't automatically set `mode`.
3943

4044

src/content/concepts/output.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ module.exports = {
6868
};
6969
```
7070

71-
In cases when the eventual `publicPath` of output files isn't known at compile time, it can be left blank and set dynamically at runtime in the entry point file. If you don't know the `publicPath` while compiling, you can omit it and set `__webpack_public_path__` on your entry point.
71+
In cases where the eventual `publicPath` of output files isn't known at compile time, it can be left blank and set dynamically at runtime via the `__webpack_public_path__` variable in the entry point file:
7272

7373
```javascript
7474
__webpack_public_path__ = myRuntimePublicPath;

src/content/concepts/plugins.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ They also serve the purpose of doing **anything else** that a [loader](/concepts
1616

1717
## Anatomy
1818

19-
A webpack **plugin** is a JavaScript object that has an [`apply`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/apply) property. This `apply` property is called by the webpack compiler, giving access to the **entire** compilation lifecycle.
19+
A webpack **plugin** is a JavaScript object that has an [`apply`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/apply) method. This `apply` method is called by the webpack compiler, giving access to the **entire** compilation lifecycle.
2020

2121
__ConsoleLogOnBuildWebpackPlugin.js__
2222

src/content/configuration/configuration-languages.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@ __tsconfig-for-webpack-config.json__
6767
{
6868
"compilerOptions": {
6969
"module": "commonjs",
70-
"target": "es5"
70+
"target": "es5",
71+
"esModuleInterop": true
7172
}
7273
}
7374
```

src/content/configuration/devtool.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ eval | +++ | +++ | no | generated code
3535
cheap-eval-source-map | + | ++ | no | transformed code (lines only)
3636
cheap-module-eval-source-map | o | ++ | no | original source (lines only)
3737
eval-source-map | -- | + | no | original source
38-
cheap-source-map | + | o | no | transformed code (lines only)
39-
cheap-module-source-map | o | - | no | original source (lines only)
38+
cheap-source-map | + | o | yes | transformed code (lines only)
39+
cheap-module-source-map | o | - | yes | original source (lines only)
4040
inline-cheap-source-map | + | o | no | transformed code (lines only)
4141
inline-cheap-module-source-map | o | - | no | original source (lines only)
4242
source-map | -- | -- | yes | original source

src/content/configuration/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ module.exports = {
6161
b: ["./app/entry-b1", "./app/entry-b2"]
6262
},
6363
</details>
64+
// defaults to ./src
6465
// Here the application starts executing
6566
// and webpack starts bundling
6667
[output](/configuration/output): {

src/content/configuration/module.md

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ contributors:
88
- jhnns
99
- dylanonelson
1010
- byzyk
11+
- pnevares
1112
---
1213

1314
These options determine how the [different types of modules](/concepts/modules) within a project will be treated.
@@ -24,16 +25,17 @@ Prevent webpack from parsing any files matching the given regular expression(s).
2425
```js
2526
module.exports = {
2627
//...
27-
noParse: /jquery|lodash/,
28+
module: {
29+
noParse: /jquery|lodash/,
2830

29-
// since webpack 3.0.0
30-
noParse: function(content) {
31-
return /jquery|lodash/.test(content);
31+
// since webpack 3.0.0
32+
noParse: function(content) {
33+
return /jquery|lodash/.test(content);
34+
}
3235
}
3336
};
3437
```
3538

36-
3739
## `module.rules`
3840

3941
`array`
@@ -96,7 +98,10 @@ Specifies the category of the loader. No value means normal loader.
9698

9799
There is also an additional category "inlined loader" which are loaders applied inline of the import/require.
98100

99-
All loaders are sorted in the order `pre, inline, normal, post` and used in this order.
101+
There are two phases that all loaders enter one after the other:
102+
103+
1. __Pitching__ phase: the pitch method on loaders is called in the order `post, inline, normal, pre`. See [Pitching Loader](/api/loaders/#pitching-loader) for details.
104+
2. __Normal__ phase: the normal method on loaders is executed in the order `pre, normal, inline, post`. Transformation on the source code of a module happens in this phase.
100105

101106
All normal loaders can be omitted (overridden) by prefixing `!` in the request.
102107

@@ -246,6 +251,13 @@ module.exports = {
246251
An array of [`Rules`](#rule) that is also used when the Rule matches.
247252

248253

254+
## `Rule.sideEffects`
255+
256+
Possible values: `false | an array of paths`
257+
258+
Indicate what parts of the module contain side effects. See [Tree Shaking](/guides/tree-shaking/#mark-the-file-as-side-effect-free) for details.
259+
260+
249261
## `Rule.test`
250262

251263
`Rule.test` is a shortcut to `Rule.resource.test`. If you supply a `Rule.test` option, you cannot also supply a `Rule.resource`. See [`Rule.resource`](#rule-resource) and [`Condition.test`](#condition) for details.

0 commit comments

Comments
 (0)