Skip to content

Commit 543147b

Browse files
Merge pull request webpack#122 from dear-lizhihua/cn
performance.md
2 parents efb8055 + 5e7446e commit 543147b

File tree

3 files changed

+20
-20
lines changed

3 files changed

+20
-20
lines changed

content/configuration/node.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ contributors:
1010

1111
`object`
1212

13-
Customize the NodeJS environment using polyfills or mocks:
13+
使用 polyfill 或 mock 来自定义 NodeJS 环境:
1414

1515
```js
1616
node: {

content/configuration/performance.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,53 +5,53 @@ contributors:
55
- thelarkinn
66
---
77

8-
These options allows you to control how webpack notifies you of assets and entrypoints that exceed a specific file limit.
9-
This feature was inspired by the idea of [webpack Performance Budgets](https://github.com/webpack/webpack/issues/3216).
8+
这些选项可以控制 webpack 如何通知「资源(asset)和入口起点超过指定文件限制」。
9+
此功能受到 [webpack 性能评估](https://github.com/webpack/webpack/issues/3216)的启发。
1010

1111
## `performance`
1212

1313
`object`
1414

15-
Configure how performance hints are shown. For example if you have an asset that is over 250kb, webpack will emit a warning notifiying you of this.
15+
配置如何展示性能提示。例如,如果一个资源超过 250kbwebpack 会对此输出一个警告来通知你。
1616

1717

1818
## `performance.hints`
1919

2020
`boolean | "error" | "warning"`
2121

22-
Turns hints on/off. In addition, tells webpack to throw either an error or a warning when hints are found. This property is set to `"warning"` by default.
22+
打开/关闭提示。此外,当找到提示时,告诉 webpack 抛出一个错误或警告。此属性默认设置为 `"warning"`
2323

24-
Given an asset is created that is over 250kb:
24+
给定一个创建后超过 250kb 的资源:
2525

2626
```js
2727
performance: {
2828
hints: false
2929
}
3030
```
3131

32-
No hint warnings or errors are shown.
32+
不展示警告或错误提示。
3333

3434
```js
3535
performance: {
3636
hints: "warning"
3737
}
3838
```
3939

40-
A warning will be displayed notifying you of a large asset. We recommend something like this for development environments.
40+
将展示一条警告,通知你这是体积大的资源。在开发环境,我们推荐这样。
4141

4242
```js
4343
performance: {
4444
hints: "error"
4545
}
4646
```
4747

48-
An error will be displayed notifying you of a large asset. We recommend using `hints: "error"` during production builds to help prevent deploying production bundles that are too large, impacting webpage performance.
48+
将展示一条错误,通知你这是体积大的资源。在生产环境构建时,我们推荐使用 `hints: "error"`,有助于防止把体积巨大的 bundle 部署到生产环境,从而影响网页的性能。
4949

5050
## `performance.maxEntrypointSize`
5151

5252
`int`
5353

54-
An entrypoint represents all assets that would be utilized during initial load time for a specific entry. This option controls when webpack should emit performance hints based on the maximum entrypoint size. The default value is `250000` (bytes).
54+
入口起点表示针对指定的入口,对于所有资源,要充分利用初始加载时(initial load time)期间。此选项根据入口起点的最大体积,控制 webpack 何时生成性能提示。默认值是:`250000` (bytes)
5555

5656
```js
5757
performance: {
@@ -63,7 +63,7 @@ performance: {
6363

6464
`int`
6565

66-
An asset is any emitted file from webpack. This option controls when webpack emits a performance hint based on individual asset size. The default value is `250000` (bytes).
66+
资源(asset)是从 webpack 生成的任何文件。此选项根据单个资源体积,控制 webpack 何时生成性能提示。默认值是:`250000` (bytes)
6767

6868

6969
```js
@@ -76,15 +76,15 @@ performance: {
7676

7777
`Function`
7878

79-
This property allows webpack to control what files are used to calculate performance hints. The default function is seen below:
79+
此属性允许 webpack 控制用于计算性能提示的文件。默认函数如下:
8080

8181
```js
8282
function(assetFilename) {
8383
return !(/\.map$/.test(assetFilename))
8484
};
8585
```
8686

87-
You can override this property by passing your own function in:
87+
你可以通过传递自己的函数来覆盖此属性:
8888

8989
```js
9090
performance: {
@@ -94,7 +94,7 @@ performance: {
9494
}
9595
```
9696

97-
The example above will only give you performance hints based on `.js` files.
97+
以上示例将只给你基于 `.js` 文件的性能提示。
9898

9999
***
100100

content/get-started/why-webpack.md

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

10-
webpack 通常会被拿来和其他工具(例如 Make, Grunt, Gulp, Browserify 或者 Brunch)对比。然而,这其中一些工具(Make, Grunt 和 Gulp 是任务运行器(task runner))与 webpack 相比,它们在用途上有很多不同,webpack 是一个模块打包器(module bundler)。直接对比它们可能会带来各种困惑,所以让我们先列出这些不同类型工具之间的差异。
10+
webpack 通常会被拿来和其他工具(例如 Make, Grunt, Gulp, Browserify 或者 Brunch)对比。然而,这其中一些工具(Make, Grunt 和 Gulp 是任务执行器(task runner))与 webpack 相比,它们在用途上有很多不同,webpack 是一个模块打包器(module bundler)。直接对比它们可能会带来各种困惑,所以让我们先列出这些不同类型工具之间的差异。
1111

12-
## 什么是任务运行器
12+
## 什么是任务执行器
1313

14-
简单从字面理解,任务运行器就是用来处理任务,例如项目的检查、构建、发布。对比*打包器*(如 Browserify, Brunch 或者 webpack),任务运行器关注在偏重于上层的问题上面。换句话说,打包器有着更多细节上的目标。
14+
简单从字面理解,任务执行器就是用来处理任务,例如项目的检查、构建、发布。对比*打包器*(如 Browserify, Brunch 或者 webpack),任务执行器关注在偏重于上层的问题上面。换句话说,打包器有着更多细节上的目标。
1515

1616

1717
## 什么是打包器?
1818

1919
大概说,打包器接收资源(例如 JavaScript 文件),然后转换为适合客户端浏览器可用的资源。这个打包过程恰好是 web 开发中最重要的问题,并且解决此问题可以消除开发过程中的大部分痛点。
2020

21-
打包器能够和任务运行器串联在一起工作。你可以将高层次的问题交给任务运行器工具,而留下打包部分给更专业的打包器工具。[grunt-webpack](https://www.npmjs.com/package/grunt-webpack)[gulp-webpack](https://www.npmjs.com/package/gulp-webpack) 都是非常好的集成示例。
21+
打包器能够和任务执行器串联在一起工作。你可以将高层次的问题交给任务执行器工具,而留下打包部分给更专业的打包器工具。[grunt-webpack](https://www.npmjs.com/package/grunt-webpack)[gulp-webpack](https://www.npmjs.com/package/gulp-webpack) 都是非常好的集成示例。
2222

23-
T> 通常 webpack 用户使用 npm `scripts` 作为它们的任务运行器启动入口,这是比较推荐的做法。跨平台支持可能会成为一个问题,但是这里有几个可行措施。
23+
T> 通常 webpack 用户使用 npm `scripts` 作为它们的任务执行器启动入口,这是比较推荐的做法。跨平台支持可能会成为一个问题,但是这里有几个可行措施。
2424

2525
T> 尽管 webpack 核心关注于打包,你可以找到各种扩展(extension),还是可以让你用任务管理器的方式去使用 webpack。
2626

@@ -56,7 +56,7 @@ T> 尽管 webpack 核心关注于打包,你可以找到各种扩展(extension)
5656
| 预处理 | **loaders, [transforms](https://github.com/webpack/transform-loader)** | loaders | transforms | plugin translate | plugin transforms | compilers, optimizers |
5757
| 浏览器替换 | `web_modules`, `.web.js`, package.json field, alias config option | alias option | package.json field, alias option | package.json, alias option | no | |
5858
| 可 require 文件 | 文件系统 | **web** | 文件系统 | 通过插件 | 文件系统或通过插件 | 文件系统 |
59-
| 运行时开销 | **243B + 20B 每个模块 + 4B 每个依赖** | 14.7kB + 0B 每个模块 + (3B + X) 每个依赖 | 415B + 25B 每个模块 + (6B + 2X) 每个依赖 | 5.5kB for 自执行 bundle, 38kB 全部 loader 和 polyfill, 0 普通模块, 293B CJS, 139B ES2015 System.register before gzip | **none for ES2015 modules**(可能有其他格式) | |
59+
| 执行时开销 | **243B + 20B 每个模块 + 4B 每个依赖** | 14.7kB + 0B 每个模块 + (3B + X) 每个依赖 | 415B + 25B 每个模块 + (6B + 2X) 每个依赖 | 5.5kB for 自执行 bundle, 38kB 全部 loader 和 polyfill, 0 普通模块, 293B CJS, 139B ES2015 System.register before gzip | **none for ES2015 modules**(可能有其他格式) | |
6060
| 观察模式 | yes | 不需要 | yes | 开发不需要 | no | yes |
6161

6262
♦ 在生产模式(在开发模式中相反)

0 commit comments

Comments
 (0)