0
我使用带有摩卡装载器插件的webpack。我有一个控制台错误:带有摩卡装载器的Webpack nextTick不是函数
Uncaught TypeError: (intermediate value).nextTick is not a function(…)
webpack.config.js:
...
target: 'web',
entry: {
app: [path.resolve(applicationConfig.source.path, 'app.js')],
vendors: [path.resolve(applicationConfig.source.path, 'vendors.js')],
testing: 'mocha!' + path.resolve(applicationConfig.source.path, 'testing.js')
},
...
我运行测试,从/testing.html文件 testing.html:
<!DOCTYPE html>
<html>
<head>
<title>Mocha</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<script src="./testing.js"></script>
</body>
</html>
Mocha- loader有start.js文件:
process.nextTick(function() {
delete require.cache[module.id];
if(typeof window !== "undefined" && window.mochaPhantomJS)
mochaPhantomJS.run();
else
mocha.run();
});
的WebPack工作之后,它看起来是这样的:
({"env":{"NODE_ENV":"development"}}).nextTick(function() {
delete __webpack_require__.c[module.id];
if(typeof window !== "undefined" && window.mochaPhantomJS)
mochaPhantomJS.run();
else
mocha.run();
});
I'l可以利用填充工具与process.nextTick(https://gist.github.com/WebReflection/2953527),但我不能代替过程变量之后。