将其他loader处理后的文本和依赖关系,持久化储存;下次取时直接返回。
webpack 匹配执行 loader 顺序:
pitch属性函数default函数由此,在pitch中做拦截判断,取得缓存后直接返回:
options.cacheIdentifier以及remainingRequest做hash处理为key,取得储存的文件remainingRequest一致FS.stat),全部一致则认为缓存可用在default函数中持久化其他loader的处理结果:
储存结构:
{
remainingRequest: String,
dependencies: [{
path: String,
mtime: Date,
}],
contextDependencies[{
path: String,
mtime: Date,
}],
result: {
type: String,
data: String,
}
}