Skip to content

Commit 3c2d135

Browse files
Merge branch 'master' into docs/dev-server-sock-port
2 parents 257b52e + 52c94bd commit 3c2d135

32 files changed

+344
-163
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ _describe your changes..._
77

88

99
[1]: https://cla.js.foundation/webpack/webpack.js.org
10-
[2]: https://webpack.js.org/writers-guide/
10+
[2]: https://webpack.js.org/contribute/writers-guide/

README.md

Lines changed: 29 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,59 @@
11
# webpack.js.org
22

3-
[![Build Status][13]][10]
4-
[![Standard Version][12]][11]
3+
[![Build Status][build-status]][build-status-url]
4+
[![Standard Version][release]][release-url]
5+
[![chat on gitter][chat]][chat-url]
56

67
Guides, documentation, and all things webpack.
78

8-
99
## Content Progress
1010

1111
Now that we've covered much of the backlog of _missing documentation_, we are
1212
starting to heavily review each section of the site's content to sort and
1313
structure it appropriately. The following issues should provide a pretty good
1414
idea of where things are, and where they are going:
1515

16-
- [Guides - Review and Simplify][1]
17-
- [Concepts - Review and Organize][2]
18-
- [API - v4 Rewrite][8]
16+
- [Guides - Review and Simplify][guides-url]
17+
- [Concepts - Review and Organize][concepts-url]
18+
- [API - v4 Rewrite][api-url]
1919

2020
We haven't created issues for the other sections yet, but they will be coming
21-
soon. For dev-related work please see [General - Updates & Fixes][3].
22-
21+
soon. For dev-related work please see [General - Updates & Fixes][general-url].
2322

2423
## Translation
2524

26-
To help translate this documentation please jump to the [translate branch][4].
27-
25+
To help translate this documentation please jump to the [translate branch][translate-url].
2826

2927
## Contributing
3028

31-
Read through the [writer's guide][7] if you're interested in editing the
32-
content on this site. See the [contributors page][5] to learn how to set up and
29+
Read through the [writer's guide][writer-guide-url] if you're interested in editing the
30+
content on this site. See the [contributors page][contributing-url] to learn how to set up and
3331
start working on the site locally.
3432

35-
3633
## License
3734

38-
The content is available under the [Creative Commons BY 4.0][6] license.
39-
35+
The content is available under the [Creative Commons BY 4.0][license-url] license.
4036

4137
## Special Thanks
4238

4339
_BrowserStack_ has graciously allowed us to do cross-browser and cross-os
4440
testing of the site at no cost...
4541

46-
[![BrowserStackLogo](./browserstack-logo.png)][9]
47-
48-
49-
[1]: https://github.com/webpack/webpack.js.org/issues/1258
50-
[2]: https://github.com/webpack/webpack.js.org/issues/1386
51-
[3]: https://github.com/webpack/webpack.js.org/issues/1525
52-
[4]: https://github.com/webpack/webpack.js.org/tree/translation
53-
[5]: https://github.com/webpack/webpack.js.org/blob/master/.github/CONTRIBUTING.md
54-
[6]: https://creativecommons.org/licenses/by/4.0/
55-
[7]: https://webpack.js.org/writers-guide
56-
[8]: https://github.com/webpack/webpack.js.org/pull/1754
57-
[9]: http://browserstack.com/
58-
[10]: http://travis-ci.org/webpack/webpack.js.org
59-
[11]: https://github.com/conventional-changelog/standard-version
60-
[12]: https://img.shields.io/badge/release-standard%20version-brightgreen.svg
61-
[13]: https://secure.travis-ci.org/webpack/webpack.js.org.svg
42+
[![BrowserStackLogo][browserstack]][browserstack-url]
43+
44+
[api-url]: https://github.com/webpack/webpack.js.org/pull/1754
45+
[build-status]: https://secure.travis-ci.org/webpack/webpack.js.org.svg
46+
[build-status-url]: http://travis-ci.org/webpack/webpack.js.org
47+
[browserstack]: ./browserstack-logo.png
48+
[browserstack-url]: http://browserstack.com/
49+
[chat]: https://badges.gitter.im/webpack/webpack.svg
50+
[chat-url]: https://gitter.im/webpack/webpack
51+
[concepts-url]: https://github.com/webpack/webpack.js.org/issues/1386
52+
[contributing-url]: https://github.com/webpack/webpack.js.org/blob/master/.github/CONTRIBUTING.md
53+
[general-url]: https://github.com/webpack/webpack.js.org/issues/1525
54+
[guides-url]: https://github.com/webpack/webpack.js.org/issues/1258
55+
[license-url]: https://creativecommons.org/licenses/by/4.0/
56+
[release]: https://img.shields.io/badge/release-standard%20version-brightgreen.svg
57+
[release-url]: https://github.com/conventional-changelog/standard-version
58+
[translate-url]: https://github.com/webpack/webpack.js.org/tree/translation
59+
[writer-guide-url]: https://webpack.js.org/contribute/writers-guide

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
"fetch:supporters": "node src/utilities/fetch-supporters.js",
3636
"fetch:starter-kits": "node src/utilities/fetch-starter-kits.js",
3737
"prebuild": "npm run clean",
38-
"build": "run-s fetch content && cross-env NODE_ENV=production webpack --config webpack.prod.js",
38+
"build": "run-s fetch content && cross-env NODE_ENV=production webpack --config webpack.ssg.js && cross-env NODE_ENV=production webpack --config webpack.prod.js",
3939
"postbuild": "npm run sitemap",
4040
"test": "npm run lint",
4141
"lint": "run-s lint:*",
@@ -45,7 +45,7 @@
4545
"lint:prose": "cp .proselintrc ~/ && proselint src/content",
4646
"lint:links": "hyperlink -r dist/index.html --canonicalroot https://webpack.js.org/ -i --todo https://img.shields.io --todo https://codecov.io/gh --todo 'content-type-mismatch https://travis-ci.org' --todo 'Asset is used as both Html and Image' | tee internal-links.tap | tap-spot",
4747
"linkcheck": "hyperlink -r dist/index.html --canonicalroot https://webpack.js.org/ --skip support__ --skip sidecar.gitter.im --skip vimdoc.sourceforge.net --skip img.shields.io --skip npmjs.com/package/ --skip opencollective.com/webpack --todo external-redirect | tee external-links.tap | tap-spot",
48-
"sitemap": "cd dist && sitemap-static --prefix=https://webpack.js.org/ > sitemap.xml",
48+
"sitemap": "cd dist && sitemap-static --pretty --prefix=https://webpack.js.org/ > sitemap.xml",
4949
"serve": "npm run build && sirv start ./dist --port 4000",
5050
"deploy": "gh-pages -d dist"
5151
},
@@ -109,6 +109,7 @@
109109
"modularscale-sass": "^3.0.3",
110110
"node-sass": "^4.5.3",
111111
"npm-run-all": "^4.1.1",
112+
"offline-plugin": "^5.0.7",
112113
"optimize-css-assets-webpack-plugin": "^5.0.1",
113114
"postcss-loader": "^2.1.3",
114115
"redirect-webpack-plugin": "^0.1.1",
-5.79 KB
Loading
-6.44 KB
Loading
-7.07 KB
Loading
-9.37 KB
Loading
-17 KB
Loading
-28.5 KB
Loading
-2.81 KB
Loading
-4.12 KB
Loading

src/components/Gitter/Gitter.scss

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,12 @@
44

55
.gitter {
66
position: fixed;
7-
right: 1.5em;
7+
right: 1em;
88
bottom: 3em;
9+
10+
@include break {
11+
right: 1.5em;
12+
}
913
}
1014

1115
.gitter__button {

src/components/Sidebar/Sidebar.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import Shield from '../Shield/Shield';
66
import SidebarItem from '../SidebarItem/SidebarItem';
77

88
// Load Styling
9-
import '../Sidebar/Sidebar.scss';
9+
import './Sidebar.scss';
1010

1111
// Create and export the component
1212
export default ({

src/components/Site/Site.jsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ import './Site.scss';
3131
// Load Content Tree
3232
import Content from '../../_content.json';
3333

34+
// call offline plugin so it can build
35+
if (isClient) {
36+
require('offline-plugin/runtime').install();
37+
}
38+
3439
class Site extends React.Component {
3540
state = {
3641
mobileSidebarOpen: false
@@ -77,6 +82,7 @@ class Site extends React.Component {
7782
<Route path="/vote" component={Vote} />
7883
<Route path="/organization" component={Organization} />
7984
<Route path="/starter-kits" component={StarterKits} />
85+
<Route path="/app-shell" component={() => <React.Fragment />} />
8086
{pages.map(page => (
8187
<Route
8288
key={page.url}

src/components/Support/Support.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ export default class Support extends React.Component {
144144

145145
{
146146
supporters.map((supporter, index) => (
147-
<a key={ supporter.id || supporter.slug || index }
147+
<a key={ supporter.slug || index }
148148
className="support__item"
149149
title={ `$${formatMoney(supporter.totalDonations / 100)} by ${supporter.name || supporter.slug}` }
150150
target="_blank"

src/content/concepts/loaders.mdx

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ contributors:
1414
- EugeneHlushko
1515
- wizardofhogwarts
1616
- lukasgeiter
17+
- furkle
1718
---
1819

1920
Loaders are transformations that are applied on the source code of a module. They allow you to pre-process files as you `import` or “load” them. Thus, loaders are kind of like “tasks” in other build tools and provide a powerful way to handle front-end build steps. Loaders can transform files from a different language (like TypeScript) to JavaScript or inline images as data URLs. Loaders even allow you to do things like `import` CSS files directly from your JavaScript modules!
@@ -94,7 +95,25 @@ It's possible to specify loaders in an `import` statement, or any [equivalent "i
9495
import Styles from 'style-loader!css-loader?modules!./styles.css';
9596
```
9697

97-
It's possible to override any loaders in the configuration by prefixing the entire rule with `!`.
98+
It's possible to override any loaders, preLoaders and postLoaders from the [configuration](/configuration) by prefixing the inline `import` statement:
99+
100+
- Prefixing with `!` will disable all configured normal loaders
101+
102+
```js
103+
import Styles from '!style-loader!css-loader?modules!./styles.css';
104+
```
105+
106+
- Prefixing with `!!` will disable all configured loaders (preLoaders, loaders, postLoaders)
107+
108+
```js
109+
import Styles from '!!style-loader!css-loader?modules!./styles.css';
110+
```
111+
112+
- Prefixing with `-!` will disable all configured preLoaders and loaders but not postLoaders
113+
114+
```js
115+
import Styles from '-!style-loader!css-loader?modules!./styles.css';
116+
```
98117

99118
Options can be passed with a query parameter, e.g. `?key=value&foo=bar`, or a JSON object, e.g. `?{"key":"value","foo":"bar"}`.
100119

@@ -130,4 +149,4 @@ functions (loaders). Users now have more flexibility to include fine-grained log
130149

131150
Loaders follow the standard [module resolution](/concepts/module-resolution/). In most cases it will be loaded from the [module path](/concepts/module-resolution/#module-paths) (think `npm install`, `node_modules`).
132151

133-
A loader module is expected to export a function and be written in Node.js compatible JavaScript. They are most commonly managed with npm, but you can also have custom loaders as files within your application. By convention, loaders are usually named `xxx-loader` (e.g. `json-loader`). See ["How to Write a Loader?"](/development/how-to-write-a-loader) for more information.
152+
A loader module is expected to export a function and be written in Node.js compatible JavaScript. They are most commonly managed with npm, but you can also have custom loaders as files within your application. By convention, loaders are usually named `xxx-loader` (e.g. `json-loader`). See ["Writing a Loader"](/contribute/writing-a-loader/) for more information.

src/content/configuration/output.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -977,3 +977,20 @@ module.exports = {
977977
```
978978

979979
will name the AMD module of the UMD build. Otherwise an anonymous `define` is used.
980+
981+
## `output.futureEmitAssets`
982+
983+
`boolean: false`
984+
985+
Tells webpack to use the future version of asset emitting logic, which allows freeing memory of assets after emitting. It could break plugins which assume that assets are still readable after they were emitted.
986+
987+
W> `output.futureEmitAssets` option will be removed in webpack v5.0.0 and this behaviour will become the new default.
988+
989+
```javascript
990+
module.exports = {
991+
//...
992+
output: {
993+
futureEmitAssets: true
994+
}
995+
};
996+
```

src/content/configuration/resolve.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ which is what enables users to leave off the extension when importing:
217217
import File from '../path/to/file';
218218
```
219219

220-
W> Using this will __override the default array__, meaning that webpack will no longer try to resolve modules using the default extensions. For modules that are imported with their extension, e.g. `import SomeFile from './somefile.ext'`, to be properly resolved, a string containing "\*" must be included in the array.
220+
W> Using this will __override the default array__, meaning that webpack will no longer try to resolve modules using the default extensions.
221221

222222

223223
### `resolve.mainFields`

src/content/configuration/stats.md

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,14 @@ module.exports = {
3333
};
3434
```
3535

36-
| Preset | Alternative | Description |
37-
|--------|-------------|-------------|
38-
| `"errors-only"` | _none_ | Only output when errors happen |
39-
| `"minimal"` | _none_ | Only output when errors or new compilation happen |
40-
| `"none"` | `false` | Output nothing |
41-
| `"normal"` | `true` | Standard output |
42-
| `"verbose"` | _none_ | Output everything |
36+
| Preset | Alternative | Description |
37+
|---------------------|-------------|---------------------------------------------------|
38+
| `"errors-only"` | _none_ | Only output when errors happen |
39+
| `"errors-warnings"` | _none_ | Only output errors and warnings happen |
40+
| `"minimal"` | _none_ | Only output when errors or new compilation happen |
41+
| `"none"` | `false` | Output nothing |
42+
| `"normal"` | `true` | Standard output |
43+
| `"verbose"` | _none_ | Output everything |
4344

4445
For more granular control, it is possible to specify exactly what information you want. Please note that all of the options in this object are optional.
4546

@@ -146,6 +147,9 @@ module.exports = {
146147
// Show dependencies and origin of warnings/errors (since webpack 2.5.0)
147148
moduleTrace: true,
148149

150+
// Show outputPath
151+
outputPath: true | false,
152+
149153
// Show performance hint when file size exceeds `performance.maxAssetSize`
150154
performance: true,
151155

src/content/guides/code-splitting.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ T> Using webpackPreload incorrectly can actually hurt performance, so be careful
331331
Once you start splitting your code, it can be useful to analyze the output to check where modules have ended up. The [official analyze tool](https://github.com/webpack/analyse) is a good place to start. There are some other community-supported options out there as well:
332332

333333
- [webpack-chart](https://alexkuz.github.io/webpack-chart/): Interactive pie chart for webpack stats.
334-
- [webpack-visualizer](https://chrisbateman.github.io/webpack-visualizer/): Visualize and analyze your bundles to see which modules are taking up space and which are might be duplicates.
334+
- [webpack-visualizer](https://chrisbateman.github.io/webpack-visualizer/): Visualize and analyze your bundles to see which modules are taking up space and which might be duplicates.
335335
- [webpack-bundle-analyzer](https://github.com/webpack-contrib/webpack-bundle-analyzer): A plugin and CLI utility that represents bundle content as a convenient interactive zoomable treemap.
336336
- [webpack bundle optimize helper](https://webpack.jakoblind.no/optimize): This tool will analyze your bundle and give you actionable suggestions on what to improve to reduce your bundle size.
337337

src/content/license.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
---
22
title: License
3-
sort: 4
3+
sort: 5
44
contributors:
55
- EugeneHlushko
6+
- pranshuchittora
67
---
78

89
## webpack

src/content/plugins/split-chunks-plugin.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ The algorithm is deterministic and changes to the modules will only have local i
157157

158158
When the chunk has a name already, each part will get a new name derived from that name. Depending on the value of `optimization.splitChunks.hidePathInfo` it will add a key derived from the first module name or a hash of it.
159159

160-
`maxSize` options is intended to be used with HTTP/2 and long term caching. It increase the request count for better caching. It could also be used to decrease the file size for faster rebuilding.
160+
`maxSize` option is intended to be used with HTTP/2 and long term caching. It increases the request count for better caching. It could also be used to decrease the file size for faster rebuilding.
161161

162162
T> `maxSize` takes higher priority than `maxInitialRequest/maxAsyncRequests`. Actual priority is `maxInitialRequest/maxAsyncRequests < maxSize < minSize`.
163163

src/content/vote.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
title: Vote
3+
sort: 4
4+
contributors:
5+
- pranshuchittora
6+
---

src/server.jsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@ const bundles = [
2020
'/index.bundle.js'
2121
];
2222

23+
// As github pages uses trailing slash, we need to provide it to canonicals for consistency
24+
// between canonical href and final url served by github pages.
25+
function enforceTrailingSlash (url) {
26+
return url.replace(/\/?$/, '/');
27+
}
28+
2329
// Export method for `SSGPlugin`
2430
export default locals => {
2531
let { assets } = locals.webpackStats.compilation;
@@ -49,6 +55,10 @@ export default locals => {
4955
<link key={ path } rel="stylesheet" href={ `/${path}` } />
5056
))}
5157
<link rel="manifest" href="/manifest.json" />
58+
<link rel="canonical" href={`https://webpack.js.org${enforceTrailingSlash(locals.path)}`} />
59+
<link rel="apple-touch-icon" href="/images/icons/icon-192x192.png" />
60+
<link rel="apple-touch-icon" sizes="152x152" href="/images/icons/icon-152x152.png" />
61+
<link rel="icon" sizes="192x192" href="/images/icons/icon-192x192.png" />
5262
</head>
5363
<body>
5464
<div id="root">

src/styles/fonts.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@
33
src: url('../assets/geomanist-medium.woff2') format('woff2'), url('../assets/geomanist-medium.woff') format('woff');
44
font-weight: 600;
55
font-style: normal;
6+
font-display: swap;
67
}

src/styles/index.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@import url('https://fonts.googleapis.com/css?family=Source+Code+Pro:400,600|Source+Sans+Pro:400,400i,600');
1+
@import url('https://fonts.googleapis.com/css?family=Source+Code+Pro:400,600|Source+Sans+Pro:400,400i,600&display=swap');
22

33
@import 'vars';
44
@import 'fonts';

0 commit comments

Comments
 (0)