Skip to content

Commit 06d1cd4

Browse files
pampangQC-L
andauthored
docs(cn): translate src/content/api/resolvers.md (#778)
Co-authored-by: QiChang Li <[email protected]>
1 parent 02cdcfa commit 06d1cd4

File tree

1 file changed

+26
-26
lines changed

1 file changed

+26
-26
lines changed

src/content/api/resolvers.md

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,31 @@
11
---
2-
title: Resolvers
2+
title: 解析器(Resolvers
33
group: Plugins
44
sort: 13
55
contributors:
66
- EugeneHlushko
77
---
88

9-
Resolvers are created using the `enhanced-resolve` package. The `Resolver`
10-
class extends the `tapable` class and uses `tapable` to provide a few hooks.
11-
The `enhanced-resolve` package can be used directly to create new resolvers,
12-
however any [`compiler` instance](/api/node/#compiler-instance) has a few resolver instances that can be
13-
tapped into.
9+
解析器是使用 `enhanced-resolve` 库创建的。`Resolver`
10+
拓展了 `tapable` 类,并使用 `tapable` 来提供了一些钩子。
11+
`enhanced-resolve` 可以直接用于创建新的解析器,
12+
但是,任何 [`compiler` 实例](/api/node/#compiler-instance) 都有一些解析器实例,可以
13+
`tap` 进去。
1414

15-
Before reading on, make sure to have a look at the
16-
[`enhanced-resolve`](https://github.com/webpack/enhanced-resolve) and [`tapable`](/api/plugins/#tapable) documentation.
15+
在继续阅读之前,请确保你已经读过
16+
[`enhanced-resolve`](https://github.com/webpack/enhanced-resolve) [`tapable`](/api/plugins/#tapable) 文档。
1717

1818

19-
## Types
19+
## 类型
2020

21-
There are three types of built-in resolvers available on the `compiler` class:
21+
`compiler` 类中,提供了三种类型的内置解析器:
2222

23-
- `normal`: Resolves a module via an absolute or relative path.
24-
- `context`: Resolves a module within a given context.
25-
- `loader`: Resolves a webpack [loader](/loaders).
23+
- `normal`: 通过绝对或相对路径解析模块。
24+
- `context`: 在给定的上下文中解析模块。
25+
- `loader`: 解析 webpack [loader](/loaders)
2626

27-
Depending on need, any one of these built-in resolvers, that are used by the `compiler`,
28-
can be customized via plugins:
27+
根据需要,任一个被使用在 `compiler` 中的内置解析器,
28+
可以通过插件进行定制:
2929

3030
``` js
3131
compiler.resolverFactory.plugin('resolver [type]', resolver => {
@@ -35,20 +35,20 @@ compiler.resolverFactory.plugin('resolver [type]', resolver => {
3535
});
3636
```
3737

38-
Where `[type]` is one of the three resolvers mentioned above.
38+
其中,`[type]` 是上述三个解析器之一。
3939

40-
See the [`enhanced-resolve` documentation](https://github.com/webpack/enhanced-resolve) for a full list of hooks and their
41-
description.
40+
请参阅 [`enhanced-resolve` documentation](https://github.com/webpack/enhanced-resolve) 以获得钩子的完整列表以及它们的
41+
介绍。
4242

4343

44-
## Configuration Options
44+
## 配置选项
4545

46-
The resolvers mentioned above can also be customized via a configuration file
47-
with the [`resolve`](/configuration/resolve/) or [`resolveLoader`](/configuration/resolve/#resolveloader) options. These options allow
48-
users to change the resolving behavior through a variety of options including
49-
through resolve `plugins`.
46+
上述解析器也可以
47+
利用 [`resolve`](/configuration/resolve/) or [`resolveLoader`](/configuration/resolve/#resolveloader) 选项,通过配置文件进行定制。这些选项允许
48+
用户可以通过多种选项来更改解析行为,包括
49+
通过解析 `plugins`
5050

51-
The resolver plugins, e.g. [`DirectoryNamedPlugin`](https://github.com/shaketbaby/directory-named-webpack-plugin), can be included
52-
directly in `resolve.plugins` rather than using directly in [`plugins` configuration option](/configuration/plugins/#plugins).
51+
解析器插件,例如:[`DirectoryNamedPlugin`](https://github.com/shaketbaby/directory-named-webpack-plugin),可以直接引入
52+
`resolve.plugins`,而不是直接在 [`plugins` configuration option](/configuration/plugins/#plugins) 中使用。
5353

54-
T> Note that the `resolve` configuration affects the `normal` and `context` resolvers while `resolveLoader` is used to modify the `loader` resolver.
54+
T> 请注意,`resolve` 配置会影响 `normal` 解析器和 `context` 解析器,而“ `resolveLoader` 用于修改 `loader` 解析器。

0 commit comments

Comments
 (0)