Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
672 views
in Technique[技术] by (71.8m points)

webpack 2 升级 4 遇到 TypeError: cb is not a function ?

webpack 2 升级 4 启动之后,修改页面会报 TypeError: cb is not a function 是什么原因呢?

// dev-server.js
var hotMiddleware = require('webpack-hot-middleware')(compiler, {
    log: () => {}
});
// force page reload when html-webpack-plugin template changes
compiler.plugin('compilation', function (compilation) {
    compilation.plugin('html-webpack-plugin-after-emit', function (data, cb) {
        console.log('html-webpack-plugin-after-emit', data, cb)
        hotMiddleware.publish({ action: 'reload' });
        cb();
    });
});
TypeError: cb is not a function
    at /Users/labs/webpack/office/build/dev-server.js:39:9
    at Promise (eval at create (/Users/labs/webpack/office/node_modules/tapable/lib/HookCodeFactory.js:74:10), <anonymous>:17:16)
    at new Promise (<anonymous>)
    at AsyncSeriesWaterfallHook.eval [as promise] (eval at create (/Users/labs/webpack/office/node_modules/tapable/lib/HookCodeFactory.js:74:10), <anonymous>:4:8)
    at AsyncSeriesWaterfallHook.lazyCompileHook (/Users/labs/webpack/office/node_modules/tapable/lib/Hook.js:154:20)
    at /Users/labs/webpack/office/node_modules/html-webpack-plugin/index.js:673:47
    at Promise.resolve.then.then.then.then.then.then.then.then.catch.then.then (/Users/labs/webpack/office/node_modules/html-webpack-plugin/index.js:214:21)
    at process._tickCallback (internal/process/next_tick.js:68:7)

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神解答

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
...