Skip to content

docs(en): merge webpack.js.org/master into webpack.js.org/cn @ 2402ab45 #1265

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 26 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
3f2b148
docs(configuration): document buildHttp (#5276)
chenxsan Aug 9, 2021
be19381
docs(configuration): Update index.mdx (#5282)
jmcscript Aug 10, 2021
beacb51
detect all broken links (#5284)
chenxsan Aug 10, 2021
48339bb
Revert "detect all broken links (#5284)" (#5286)
chenxsan Aug 10, 2021
7e82c02
clean up alex configurations (#5281)
chenxsan Aug 10, 2021
c038c71
Add new page for awesome-webpack (#5275)
snitin315 Aug 10, 2021
ee9761e
migrate md to mdx (#5233)
chenxsan Aug 10, 2021
c63f91b
build(deps): bump path-parse from 1.0.6 to 1.0.7 (#5287)
dependabot[bot] Aug 10, 2021
26b56cd
docs(configuration): update `infrastructureLogging.debug` and `infras…
snitin315 Aug 11, 2021
3582696
docs(guides): Update asset-modules.mdx (#5289)
jmcscript Aug 11, 2021
570c5ce
docs(configuration): sort output options alphabetically (#5292)
chenxsan Aug 13, 2021
6c8940e
docs(migrate): Fix some grammatical errors in 5.mdx (#5290)
getsnoopy Aug 14, 2021
164c97b
docs(plugins): Replaced jargon words with better equivalents (#5291)
getsnoopy Aug 14, 2021
a95ae23
docs(migrate): Fix optimization.moduleIds setting in 5.mdx (#5293)
akccakcctw Aug 14, 2021
a444ae4
docs(configuration): remove `enforceModuleExtension` from resolve doc…
snitin315 Aug 14, 2021
a7d26c6
Deprecate loaders (#5294)
chenxsan Aug 14, 2021
8501d04
docs(configuration): sort `performance` options (#5295)
snitin315 Aug 15, 2021
d556930
docs(configuration): fix dev server options link (#5301)
anshumanv Aug 17, 2021
78f5e1f
docs(configuration): update documentation for webpack-dev-server v4 (…
snitin315 Aug 19, 2021
c2cab7e
docs(configuration): update link for `serve` options (#5303)
snitin315 Aug 19, 2021
702390a
fetch readme.md as mdx (#5298)
chenxsan Aug 19, 2021
2560fce
docs(configuration): add devserver.onListening (#5304)
snitin315 Aug 19, 2021
75baff0
docs(configuration): add `devServer.setupExitSignals` (#5305)
snitin315 Aug 19, 2021
01fe3f1
docs(configuration): update `static.publicPath` type (#5306)
snitin315 Aug 19, 2021
2402ab4
docs(concepts): close issue #5308 (#5309)
chenxsan Aug 19, 2021
23fdeea
docs(en): merging all conflicts
docschina-bot Aug 19, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .alexignore

This file was deleted.

35 changes: 0 additions & 35 deletions .alexrc

This file was deleted.

2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ package-lock.json
.cache
internal-links.tap
stats.json
printable.md
printable.mdx
repositories/*.json
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
},
"scripts": {
"clean-dist": "rimraf ./dist",
"clean-printable": "rimraf src/content/**/printable.md",
"clean-printable": "rimraf src/content/**/printable.mdx",
"preclean": "run-s clean-dist clean-printable",
"clean": "rimraf src/content/**/_*.md src/**/_*.json repositories/*.json",
"start": "npm run clean-dist && webpack serve --config webpack.dev.js --env dev --progress --node-env development",
Expand Down
7 changes: 7 additions & 0 deletions src/components/BrandingSample.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import PropTypes from 'prop-types';
BrandingSample.propTypes = {
color: PropTypes.string.isRequired,
};
export default function BrandingSample({ color }) {
return <div style={{ backgroundColor: color }}>&nbsp;</div>;
}
3 changes: 3 additions & 0 deletions src/components/Footer/Footer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ const Footer = () => (
<Link className="footer__link" to="https://webpack.threadless.com/">
周边
</Link>
<Link className="footer__link" to="/awesome-webpack/">
Awesome webpack
</Link>
<Link className="footer__link" to="/glossary/">
术语
</Link>
Expand Down
4 changes: 2 additions & 2 deletions src/components/Site/Site.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ function Site(props) {
*/
const _strip = (array) => {
let anchorTitleIndex = array.findIndex(
(item) => item.name.toLowerCase() === 'index.md'
(item) => item.name.toLowerCase() === 'index.mdx'
);

if (anchorTitleIndex !== -1) {
Expand Down Expand Up @@ -109,7 +109,7 @@ function Site(props) {
})
.filter(
(page) =>
page.title !== 'printable.md' && !page.content.includes('Printable')
page.title !== 'printable.mdx' && !page.content.includes('Printable')
);
};

Expand Down
8 changes: 2 additions & 6 deletions src/components/Splash/Splash.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { PlaceholderComponent } from '../Placeholder/Placeholder';
import isClient from '../../utilities/is-client';

// Import Demo Content
import SplashContent from '../../content/index.md';
import SplashContent from '../../content/index.mdx';

// Load Styling
import './Splash.scss';
Expand Down Expand Up @@ -55,11 +55,7 @@ const Splash = () => {
<div className="splash__section splash__section--dark page__content">
<Container>
<Markdown>
<div
dangerouslySetInnerHTML={{
__html: SplashContent,
}}
/>
<SplashContent />
</Markdown>
</Container>
</div>
Expand Down
7 changes: 7 additions & 0 deletions src/components/Splash/first/left.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
**src/index.js**

```js
import bar from './bar.js';

bar();
```
7 changes: 7 additions & 0 deletions src/components/Splash/first/right.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
**src/bar.js**

```js
export default function bar() {
//
}
```
13 changes: 13 additions & 0 deletions src/components/Splash/second/left.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
**[Without config](https://youtu.be/3Nv9muOkb6k?t=21293)** or provide custom **webpack.config.js**

```js
const path = require('path');

module.exports = {
entry: './src/index.js',
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'bundle.js',
},
};
```
15 changes: 15 additions & 0 deletions src/components/Splash/second/right.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
**page.html**

```html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
...
</head>
<body>
...
<script src="dist/bundle.js"></script>
</body>
</html>
```
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
287 changes: 287 additions & 0 deletions src/content/awesome-webpack.mdx

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,11 @@ webpack 是完全基于[赞助](https://opencollective.com/webpack)的。

### 不再为 Node.js 模块 自动引用 Polyfills {#automatic-nodejs-polyfills-removed}

<<<<<<< HEAD:src/content/blog/2020-10-10-webpack-5-release.md
在早期,webpack 的目的是为了让大多数的 Node.js 模块运行在浏览器中,但如今模块的格局已经发生了变化,现在许多模块主要是为前端而编写。webpack <= 4 的版本中提供了许多 Node.js 核心模块的 polyfills,一旦某个模块引用了任何一个核心模块(如 `cypto` 模块),webpack 就会自动引用这些 polyfills。
=======
In the early days, webpack's aim was to allow running most Node.js modules in the browser, but the module landscape changed and many module uses are now written mainly for frontend purposes. webpack &lt;= 4 ships with polyfills for many of the Node.js core modules, which are automatically applied once a module uses any of the core modules (i.e. the `crypto` module).
>>>>>>> 2402ab45e5bd20ba625232fa520ce995ebb4a8be:src/content/blog/2020-10-10-webpack-5-release.mdx

尽管这会使得使用为 Node.js 编写模块变得容易,但它在构建时给 bundle 附加了庞大的 polyfills。在大部分情况下,这些 polyfills 并非必须。

Expand Down
File renamed without changes.
63 changes: 56 additions & 7 deletions src/content/branding.md → src/content/branding.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,13 @@ translators:
- jacob-lcs
---

<<<<<<< HEAD:src/content/branding.md
在这里你可以找到 **webpack** 项目的品牌指南、资源和许可证。有关更多信息,请通过查看我们的官方[媒体仓库](https://github.com/webpack/media),并找到[许可证](https://github.com/webpack/media/blob/master/LICENSE)来了解。点击任意图片下载它们。
=======
import BrandingSample from '../components/BrandingSample.jsx';

Here you can find **webpack** project brand guidelines, assets, and license. See our official [media repository](https://github.com/webpack/media) for more information and to find the [license](https://github.com/webpack/media/blob/master/LICENSE) that governs this work. Click any of the images to download them.
>>>>>>> 2402ab45e5bd20ba625232fa520ce995ebb4a8be:src/content/branding.mdx

## 名称 {#the-name}

Expand All @@ -22,16 +28,27 @@ Webpack 在句子的开头可以是大写字母 W,否则它应该全部为小

webpack logo 应放置在白色背景上,并且其周围有足够间距,如下所示:

<img src="https://raw.githubusercontent.com/webpack/media/master/logo/logo-on-white-bg.png" alt="webpack logo default with proper spacing on light background" />
<img
src="https://raw.githubusercontent.com/webpack/media/master/logo/logo-on-white-bg.png"
alt="webpack logo default with proper spacing on light background"
/>

[svg](https://github.com/webpack/media/blob/master/logo/logo-on-white-bg.svg) | [png](https://github.com/webpack/media/blob/master/logo/logo-on-white-bg.png) | [jpg](https://github.com/webpack/media/blob/master/logo/logo-on-white-bg.jpg)

将内部深蓝色正方体的大小加倍,就可以知道 logo 应占据多大空间。

对于深色背景,可以使用 logo 的反色版本:

<div style="display: block; background: #111;">
<img src="https://raw.githubusercontent.com/webpack/media/master/logo/logo-on-dark-bg.png" alt="webpack logo default with proper spacing on light background" />
export const style = {
display: 'block',
background: '#111',
};

<div style={style}>
<img
src="https://raw.githubusercontent.com/webpack/media/master/logo/logo-on-dark-bg.png"
alt="webpack logo default with proper spacing on light background"
/>
</div>

[svg](https://github.com/webpack/media/blob/master/logo/logo-on-dark-bg.svg) | [png](https://github.com/webpack/media/blob/master/logo/logo-on-dark-bg.png) | [jpg](https://github.com/webpack/media/blob/master/logo/logo-on-dark-bg.jpg)
Expand All @@ -42,30 +59,47 @@ T> 请尽可能的使用**图标 + 文本**的组合方式。

**图标旨在用于布局有限的区域。如前所述,最好选择 图标+文字 的组合方式**。

<img src="https://raw.githubusercontent.com/webpack/media/master/logo/icon.png" width="250" alt="icon example">
<img
src="https://raw.githubusercontent.com/webpack/media/master/logo/icon.png"
width="250"
alt="icon example"
/>

[svg](https://github.com/webpack/media/blob/master/logo/icon.svg) | [png](https://github.com/webpack/media/blob/master/logo/icon.png) | [jpg](https://github.com/webpack/media/blob/master/logo/icon.jpg)

适用于较大区域的正方形尺寸图标(例如头像或个人图片):

<img src="https://raw.githubusercontent.com/webpack/media/master/logo/icon-square-big.png" width="250" alt="icon square big example">
<img
src="https://raw.githubusercontent.com/webpack/media/master/logo/icon-square-big.png"
width="250"
alt="icon square big example"
/>

[svg](https://github.com/webpack/media/blob/master/logo/icon-square-big.svg) | [png](https://github.com/webpack/media/blob/master/logo/icon-square-big.png) | [jpg](https://github.com/webpack/media/blob/master/logo/icon-square-big.jpg)

适用于较小区域的正方形尺寸图标(例如,favicon):

<img src="https://raw.githubusercontent.com/webpack/media/master/logo/icon-square-small.png" width="50" alt="icon square small example">
<img
src="https://raw.githubusercontent.com/webpack/media/master/logo/icon-square-small.png"
width="50"
alt="icon square small example"
/>

[svg](https://github.com/webpack/media/blob/master/logo/icon-square-small.svg) | [png](https://github.com/webpack/media/blob/master/logo/icon-square-small.png) | [jpg](https://github.com/webpack/media/blob/master/logo/icon-square-small.jpg)

T> 对于那些遵循我们的指南,并已经深入了解的人,我们还制作了一个专门用于自定义 emoji 符号的特殊小尺寸图片(例如,在 slack 或 gitter 频道 ;))。

<img src="/assets/icon-square-small-slack.png" width="50" alt="icon square small example">
<img
src="/assets/icon-square-small-slack.png"
width="50"
alt="icon square small example"
/>

## 调色板 {#color-palette}

在 [Open Collective](https://opencollective.com/) 和 [Threadless](https://medium.com/u/840563ee2a56) 的帮助下,以下颜色在我们整个网站中被以各种组合形式使用,并且在 [webpack 官方商城](https://webpack.threadless.com/collections/the-final-release-collection/) 推出的时尚服装系列中也用了这些颜色!

<<<<<<< HEAD:src/content/branding.md
| 颜色名称 | HEX 码 | RGB 码 | 示例 |
| ------------ | ------------- | -------------------- | ---------------------------------------------------- |
| Malibu: | HEX `#8dd6f9` | `rgb: 141, 214, 249` | <div style="background-color: #8dd6f9;">&nbsp;</div> |
Expand All @@ -79,6 +113,21 @@ T> 对于那些遵循我们的指南,并已经深入了解的人,我们还
| Dove Gray: | HEX `#666666` | `rgb: 102, 102, 102` | <div style="background-color: #666666;">&nbsp;</div> |
| Emperor: | HEX `#535353` | `rgb: 83, 83, 83` | <div style="background-color: #535353;">&nbsp;</div> |
| Mine Shaft: | HEX `#333333` | `rgb: 51, 51, 51` | <div style="background-color: #333333;">&nbsp;</div> |
=======
| Color Name | HEX Code | RGB Code | Sample |
| ------------ | ------------- | -------------------- | ---------------------------------- |
| Malibu: | HEX `#8dd6f9` | `rgb: 141, 214, 249` | <BrandingSample color='#8dd6f9' /> |
| Denim: | HEX `#1d78c1` | `rgb: 29, 120, 193` | <BrandingSample color='#1d78c1' /> |
| Fiord: | HEX `#465E69` | `rgb: 70, 94, 105` | <BrandingSample color='#465E69' /> |
| Outer Space: | HEX `#2B3A42` | `rgb: 43, 58, 66` | <BrandingSample color='#2B3A42' /> |
| White: | HEX `#ffffff` | `rgb: 255, 255, 255` | <BrandingSample color='#ffffff' /> |
| Concrete: | HEX `#f2f2f2` | `rgb: 242, 242, 242` | <BrandingSample color='#f2f2f2' /> |
| Alto: | HEX `#dedede` | `rgb: 222, 222, 222` | <BrandingSample color='#dedede' /> |
| Dusty Gray: | HEX `#999999` | `rgb: 153, 153, 153` | <BrandingSample color='#999999' /> |
| Dove Gray: | HEX `#666666` | `rgb: 102, 102, 102` | <BrandingSample color='#666666' /> |
| Emperor: | HEX `#535353` | `rgb: 83, 83, 83` | <BrandingSample color='#535353' /> |
| Mine Shaft: | HEX `#333333` | `rgb: 51, 51, 51` | <BrandingSample color='#333333' /> |
>>>>>>> 2402ab45e5bd20ba625232fa520ce995ebb4a8be:src/content/branding.mdx

此外,你可以直接从下面的链接,获取这些类型的文件:

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
15 changes: 12 additions & 3 deletions src/content/concepts/module-federation.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ T> [`output.publicPath`](/configuration/output/#outputpublicpath) 配置项也

## 故障排除 {#troubleshooting}

**`Uncaught Error: Shared module is not available for eager consumption`**
### `Uncaught Error: Shared module is not available for eager consumption`

应用程序正急切地执行一个作为全局主机运行的应用程序。有如下选项可供选择:

Expand Down Expand Up @@ -352,7 +352,7 @@ new ModuleFederationPlugin({
});
```

**`Uncaught Error: Module "./Button" does not exist in container.`**
### `Uncaught Error: Module "./Button" does not exist in container.`

错误提示中可能不会显示 `"./Button"`,但是信息看起来差不多。这个问题通常会出现在将 webpack beta.16 升级到 webpack beta.17 中。

Expand All @@ -367,7 +367,16 @@ new ModuleFederationPlugin({
});
```

**`Uncaught TypeError: fn is not a function`**
### `Uncaught TypeError: fn is not a function`

<<<<<<< HEAD
此处错误可能是丢失了远程容器,请确保在使用前添加它。
如果已为试图使用远程服务器的容器加载了容器,但仍然看到此错误,则需将主机容器的远程容器文件也添加到 HTML 中。
=======
You are likely missing the remote container, make sure it's added.
If you have the container loaded for the remote you are trying to consume, but still see this error, add the host container's remote container file to the HTML as well.

### Collision between modules from different remotes

If you're going to load multiple modules from different remotes, it's advised to set the [`output.uniqueName`](/configuration/output/#outputuniquename) option for your remote builds to avoid collisions between multiple webpack runtimes.
>>>>>>> 2402ab45e5bd20ba625232fa520ce995ebb4a8be
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,11 @@ const pluginName = 'ConsoleLogOnBuildWebpackPlugin';
class ConsoleLogOnBuildWebpackPlugin {
apply(compiler) {
compiler.hooks.run.tap(pluginName, (compilation) => {
<<<<<<< HEAD:src/content/concepts/plugins.md
console.log('webpack 构建过程开始!');
=======
console.log('The webpack build process is starting!');
>>>>>>> 2402ab45e5bd20ba625232fa520ce995ebb4a8be:src/content/concepts/plugins.mdx
});
}
}
Expand Down
File renamed without changes.
Loading