Skip to content

docs(cn): translation of src/content/loaders/source-map-loader.md #797

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

Merged
merged 7 commits into from
Jul 6, 2020
Merged
Changes from all commits
Commits
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
38 changes: 19 additions & 19 deletions src/content/loaders/source-map-loader.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,17 @@ repo: https://github.com/webpack-contrib/source-map-loader



Extracts source maps from existing source files (from their <code>sourceMappingURL</code>).
从现有的源文件中提取 source maps(从 <code>sourceMappingURL</code> 中提取)。

## Getting Started
## 起步

To begin, you'll need to install `source-map-loader`:
安装 `source-map-loader`

```bash
npm i -D source-map-loader
```

Then add the plugin to your `webpack` config. For example:
添加 plugin `webpack` 配置。例:

**file.js**

Expand All @@ -50,21 +50,21 @@ module.exports = {
};
```

`source-map-loader` extracts existing source maps from all JavaScript entries.
This includes both inline source maps as well as those linked via URL.
All source map data is passed to webpack for processing as per a chosen [source map style](/configuration/devtool/) specified by the `devtool` option in [webpack.config.js](/configuration/).
This loader is especially useful when using 3rd-party libraries having their own source maps.
If not extracted and processed into the source map of the webpack bundle, browsers may misinterpret source map data. `source-map-loader` allows webpack to maintain source map data continuity across libraries so ease of debugging is preserved.
`source-map-loader` will extract from any JavaScript file, including those in the `node_modules` directory.
Be mindful in setting [include](/configuration/module/#ruleinclude) and [exclude](/configuration/module/#ruleexclude) rule conditions to maximize bundling performance.
`source-map-loader` 从 JavaScript 入口提取现有的 source maps.
这些 source maps 既可以是内联的也可以是通过 URL 链接引入的。
所有的 source map 数据都按照选定的 [source map style](/configuration/devtool/) 交给 webpack 处理,这些选定可以在 [webpack.config.js](/configuration/) 的 `devtool` 选项中配置。
在使用有自己 source maps 的第三方库时,`source-map-loader` 就显得尤为重要。
如果相关 source map 数据没有按照规范提取、处理并注入 webpack bundle, 浏览器有可能无法正确解读这些数据。`source-map-loader` 允许 webpack 跨库且持续的维护 source map 数据,因而更易于调试。
`source-map-loader` 可以从任何 JavaScript 文件中提取,这也包括 `node_modules` 目录下的 JavaScript 文件。
在设置 [include](/configuration/module/#ruleinclude) [exclude](/configuration/module/#ruleexclude) 规则时,要保证构建性能最优。

And run `webpack` via your preferred method.
最后按偏好运行 `webpack` 方法。

## Examples
## 示例

### Ignoring Warnings
### 忽略警告

To ignore warnings, you can use the following configuration:
忽略警告可以使用以下配置:

**webpack.config.js**

Expand All @@ -85,15 +85,15 @@ module.exports = {
};
```

More information about the `warningsFilters` option you can find [here](/configuration/stats/#statswarningsfilter);
有关 `warningsFilters` 选项的详细信息请[参阅](/configuration/stats/#statswarningsfilter)

## Contributing
## 贡献

Please take a moment to read our contributing guidelines if you haven't yet done so.
如果您尚未了解,建议您阅读以下贡献指引。

[CONTRIBUTING](https://github.com/webpack-contrib/source-map-loader/blob/master/.github/CONTRIBUTING.md)

## License
## 许可

[MIT](https://github.com/webpack-contrib/source-map-loader/blob/master/LICENSE)

Expand Down