webpack - 如何调试 chunk.isInitial() 不是函数
问题描述
我正在更新到 webpack@4.23,我在TypeError: chunk.isInitial() is not a function
我的一个自定义 webpack 插件中遇到了这个编译错误,可能是我们需要更新一些语法,但基本上我想知道的是如何调试 webpack 插件,因为我可能会跑到最肯定的其他一些编译错误:D
这是插件的片段
const asyncLib = require('async');
// Plugin starts here
class CustomPluginName {
constructor(options) {
this.options = options;
}
apply(compiler) {
compiler.plugin('emit', (compilation, callback) => {
////// doing something
asyncLib.forEach(compilation.chunks, (chunk, chnkCallback) => {
if (!chunk.isInitial()) { // error occuring here
chnkCallback();
return;
}
// rest of code
});
});
}
}
解决方案
推荐阅读
- javascript - 如何使标签值在中继器中不可搜索?
- android - 尝试分享照片时出现异常
- ssas - 在缓慢变化的维度上使用 DAX 计算溢价总和时出错
- node.js - Mongodb Atlas 连接正在Maxing out。实例 M10(350 个并发连接)
- excel - VBA:将表格从 Excel 粘贴到 Word 在 Mac 上崩溃
- webpack - 带有 contenthash 的 webpack SSR 加载包
- java - Spring boot 2.0 服务:从 Rabbit mq 传递但未到达 java 代码的消息
- python - 我可以使用没有 paramiko 的代理在 python 中设置 sftp 连接吗?
- python - Selenium webdriver 无法创建 Firefox 实例
- java - 如何使用 morphia 为 mongo 中的文档设置 TTL?