Skip to content

Commit 3eaf31d

Browse files
authored
Merge branch 'master' into add-default-ignored-value
2 parents 7b3be5f + 76c278c commit 3eaf31d

21 files changed

+580
-101
lines changed

.github/FUNDING.yml

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
open_collective: webpack
2+

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,5 @@ npm-debug.log
99
yarn-error.log
1010
package-lock.json
1111
.cache
12-
internal-links.tap
12+
internal-links.tap
13+
stats.json

README.md

+29-31
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

+10-1
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,14 @@
3030
"update-repos": "node src/utilities/fetch-package-repos.js",
3131
"content": "node src/scripts/build-content-tree.js ./src/content ./src/_content.json",
3232
"build-test": "npm run build && http-server dist/",
33+
"bundle-analyze": "run-s clean fetch content && cross-env NODE_ENV=production webpack --config webpack.ssg.js && cross-env NODE_ENV=production webpack --config webpack.prod.js --profile --json > stats.json && webpack-bundle-analyzer stats.json",
3334
"fetch": "run-p fetch:*",
3435
"fetch:readmes": "node src/utilities/fetch-package-readmes.js",
3536
"fetch:supporters": "node src/utilities/fetch-supporters.js",
3637
"fetch:starter-kits": "node src/utilities/fetch-starter-kits.js",
3738
"prebuild": "npm run clean",
3839
"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",
39-
"postbuild": "npm run sitemap",
40+
"postbuild": "bundlesize && npm run sitemap",
4041
"test": "npm run lint",
4142
"lint": "run-s lint:*",
4243
"lint:js": "eslint src --ext .js,.jsx,.md --cache true --cache-location .cache/.eslintcache",
@@ -62,6 +63,12 @@
6263
"npm run lint:markdown"
6364
]
6465
},
66+
"bundlesize": [
67+
{
68+
"path": "./dist/index.bundle.js",
69+
"maxSize": "200 kB"
70+
}
71+
],
6572
"devDependencies": {
6673
"@mdx-js/loader": "0.15.7",
6774
"@mdx-js/mdx": "0.15.7",
@@ -76,6 +83,7 @@
7683
"babel-plugin-transform-object-rest-spread": "^6.26.0",
7784
"babel-preset-env": "^1.6.0",
7885
"babel-preset-react": "^6.24.1",
86+
"bundlesize": "^0.17.1",
7987
"copy-webpack-plugin": "4.5.2",
8088
"cross-env": "5.2.0",
8189
"css-loader": "^0.28.10",
@@ -135,6 +143,7 @@
135143
"through2": "^2.0.3",
136144
"uglifyjs-webpack-plugin": "^1.1.6",
137145
"webpack": "^4.30.0",
146+
"webpack-bundle-analyzer": "^3.3.2",
138147
"webpack-cli": "^3.2.3",
139148
"webpack-dev-server": "^3.2.1",
140149
"webpack-merge": "^4.1.0"

src/components/Page/Page.jsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import React from 'react';
55
import PageLinks from '../PageLinks/PageLinks';
66
import Markdown from '../Markdown/Markdown';
77
import Contributors from '../Contributors/Contributors';
8-
import Placeholder from '../Placeholder/Placeholder';
8+
import {PlaceholderString} from '../Placeholder/Placeholder';
99
import Configuration from '../Configuration/Configuration';
1010

1111
// Load Styling
@@ -19,7 +19,7 @@ class Page extends React.Component {
1919
const isDynamicContent = content instanceof Promise;
2020

2121
this.state = {
22-
content: isDynamicContent ? Placeholder() : content.default || content,
22+
content: isDynamicContent ? PlaceholderString() : content.default || content,
2323
contentLoaded: isDynamicContent ? false : true
2424
};
2525
}

src/components/Placeholder/Placeholder.js

+17-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1+
import React from 'react';
2+
13
// Import Styling
24
import './Placeholder.scss';
35

46
// Placeholder string
5-
const Placeholder = () => (`
7+
const PlaceholderString = () => (`
68
<div class="placeholder">
79
<p class="placeholder__medium">&nbsp;</p>
810
<p class="placeholder__large">&nbsp;</p>
@@ -22,4 +24,17 @@ const Placeholder = () => (`
2224
</div>
2325
`);
2426

25-
export default Placeholder;
27+
function PlaceholderComponent() {
28+
return (
29+
<div className="placeholder">
30+
<p>&nbsp;</p>
31+
<p>&nbsp;</p>
32+
<p>&nbsp;</p>
33+
</div>
34+
);
35+
}
36+
37+
export {
38+
PlaceholderString,
39+
PlaceholderComponent
40+
};

src/components/Splash/Splash.jsx

+5-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import React from 'react';
55
import Container from '../Container/Container';
66
import SplashViz from '../SplashViz/SplashViz';
77
import Markdown from '../Markdown/Markdown';
8-
import Support from '../Support/Support';
8+
import {PlaceholderComponent} from '../Placeholder/Placeholder';
99

1010
// Import helpers
1111
import isClient from '../../utilities/is-client';
@@ -16,6 +16,8 @@ import SplashContent from '../../content/index.md';
1616
// Load Styling
1717
import './Splash.scss';
1818

19+
const Support = React.lazy(() => import('../Support/Support'));
20+
1921
const Splash = () => (
2022
<div className="splash">
2123
<SplashViz />
@@ -42,7 +44,7 @@ const Splash = () => (
4244
</p>
4345

4446
{ isClient ? (
45-
<React.Fragment>
47+
<React.Suspense fallback={<PlaceholderComponent />}>
4648
<h2>Latest Sponsors</h2>
4749
<Support rank="latest" />
4850

@@ -60,7 +62,7 @@ const Splash = () => (
6062

6163
<h2>Backers</h2>
6264
<Support rank="backer" />
63-
</React.Fragment>
65+
</React.Suspense>
6466
) : null }
6567
</Markdown>
6668
</Container>

src/components/StarterKits/StarterKits.jsx

+9-25
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
11
import React from 'react';
22
import Container from '../Container/Container';
33
import Link from '../Link/Link';
4-
import Kits from './_starter-kits.json';
4+
import {PlaceholderComponent} from '../Placeholder/Placeholder';
55
import './StarterKits.scss';
6+
import isClient from '../../utilities/is-client';
67

78
// NOTE: The table classes used in this component correspond to
89
// those used in the markdown utility. Ideally we will soon create
910
// a table component that both the markdown utility and this page
1011
// can use. This component could even use something like griddle
1112
// to allow sorting and such.
1213

14+
const StarterKitsTable = React.lazy(() => import('./StarterKitsTable'));
15+
1316
const StarterKits = props => (
1417
<Container className="starter-kits page__content markdown">
1518
<h1>Starter Kits</h1>
@@ -42,30 +45,11 @@ const StarterKits = props => (
4245
<div className="table-th">Tags</div>
4346
</div>
4447
</div>
45-
<div className="table-body">
46-
{ Kits.map((kit, i) => (
47-
<div className="table-tr" key={ i }>
48-
<div className="table-td">
49-
<div className="table-td-title">Project Name</div>
50-
<div className="table-td-content">
51-
<Link to={ kit.githubUrl }>{ kit.githubRepoName }</Link>
52-
</div>
53-
</div>
54-
<div className="table-td">
55-
<div className="table-td-title">Maintainer</div>
56-
<div className="table-td-content">{ kit.githubUserName }</div>
57-
</div>
58-
<div className="table-td">
59-
<div className="table-td-title">Tags</div>
60-
<div className="table-td-content">
61-
{ kit.tags.map((tag, i) => (
62-
<span key={ i } className="starter-kits__tag">{ tag }</span>
63-
)) }
64-
</div>
65-
</div>
66-
</div>
67-
))}
68-
</div>
48+
{ isClient ? (
49+
<React.Suspense fallback={<PlaceholderComponent />}>
50+
<StarterKitsTable />
51+
</React.Suspense>) : null
52+
}
6953
</div>
7054
</div>
7155
</Container>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import React from 'react';
2+
import Kits from './_starter-kits.json';
3+
import Link from '../Link/Link';
4+
5+
const StarterKitsTable = props => (
6+
<div className="table-body">
7+
{ Kits.map((kit, i) => (
8+
<div className="table-tr" key={ i }>
9+
<div className="table-td">
10+
<div className="table-td-title">Project Name</div>
11+
<div className="table-td-content">
12+
<Link to={ kit.githubUrl }>{ kit.githubRepoName }</Link>
13+
</div>
14+
</div>
15+
<div className="table-td">
16+
<div className="table-td-title">Maintainer</div>
17+
<div className="table-td-content">{ kit.githubUserName }</div>
18+
</div>
19+
<div className="table-td">
20+
<div className="table-td-title">Tags</div>
21+
<div className="table-td-content">
22+
{ kit.tags.map((tag, i) => (
23+
<span key={ i } className="starter-kits__tag">{ tag }</span>
24+
)) }
25+
</div>
26+
</div>
27+
</div>
28+
))}
29+
</div>
30+
);
31+
32+
export default StarterKitsTable;

src/components/Support/Support.jsx

+1-1
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/api/loaders.md

+7
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,13 @@ Emit a file. This is webpack-specific.
436436
Access to the `compilation`'s `inputFileSystem` property.
437437
438438
439+
### `this.mode`
440+
441+
Read in which [`mode`](/configuration/mode/) webpack is running.
442+
443+
Possible values: `'production'`, `'development'`, `'none'`
444+
445+
439446
## Deprecated context properties
440447
441448
W> The usage of these properties is highly discouraged since we are planning to remove them from the context. They are still listed here for documentation purposes.

0 commit comments

Comments
 (0)