Webpack的pitching loader是如何实现复杂文件类型转换的?

2026-04-06 13:580阅读0评论SEO资讯
  • 内容介绍
  • 文章标签
  • 相关推荐

本文共计520个文字,预计阅读时间需要3分钟。

Webpack的pitching loader是如何实现复杂文件类型转换的?

Webpack中关于pitching loader的文档比较模糊:loader是从右到左调用的。但在某些情况下,loader并不关心前一个loader的结果或资源。它们只关心元数据。pitch meta

webpack中关于pitching loader的文档比较不清楚:

The loaders are called from right to left. But in some cases loaders do not care about the results of the previous loader or the resource. They only care for metadata. The pitch method on the loaders is called from left to right before the loaders are called. If a loader delivers a result in the pitch method the process turns around and skips the remaining loaders, continuing with the calls to the more left loaders. data can be passed between pitch and normal call.

比如a!b!c!module, 正常调用顺序应该是c、b、a,但是真正调用顺序是
a(pitch)、b(pitch)、c(pitch)、c、b、a, 如果其中任何一个pitching loader返回了值就相当于在它以及它右边的loader已经执行完毕。

阅读全文

本文共计520个文字,预计阅读时间需要3分钟。

Webpack的pitching loader是如何实现复杂文件类型转换的?

Webpack中关于pitching loader的文档比较模糊:loader是从右到左调用的。但在某些情况下,loader并不关心前一个loader的结果或资源。它们只关心元数据。pitch meta

webpack中关于pitching loader的文档比较不清楚:

The loaders are called from right to left. But in some cases loaders do not care about the results of the previous loader or the resource. They only care for metadata. The pitch method on the loaders is called from left to right before the loaders are called. If a loader delivers a result in the pitch method the process turns around and skips the remaining loaders, continuing with the calls to the more left loaders. data can be passed between pitch and normal call.

比如a!b!c!module, 正常调用顺序应该是c、b、a,但是真正调用顺序是
a(pitch)、b(pitch)、c(pitch)、c、b、a, 如果其中任何一个pitching loader返回了值就相当于在它以及它右边的loader已经执行完毕。

阅读全文