编译失败.webpack 不是一个函数 [英] Failed to compile. webpack is not a function
问题描述
我的项目运行良好,但在安装 react-redux 和 redux 后,我无法启动该项目,它向我显示此错误
My project was working fine but after installing react-redux and redux i can't start the project it shows me this error
编译失败.
webpack 不是函数
webpack is not a function
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! project@0.1.0 start: `node scripts/start.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the project@0.1.0 start script.
npm 错误!这可能不是 npm 的问题.上面可能有额外的日志输出.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
推荐答案
在升级我的所有节点模块(包括 react 和 redux,尤其是 react-dev-utils 到 v8.0.0)后,我遇到了同样的问题.createCompiler()
函数已更改为期望一个对象而不是多个参数(我想这将在未来提供更大的灵活性).
I ran into a problem with this same symptom after upgrading all of my node modules including react and redux, but in particular react-dev-utils to v8.0.0. The createCompiler()
function has been changed to expect an object rather than multiple parameters (I guess this will provide greater flexibility in the future).
我更改了我的 start.js:
I changed my start.js from:
const compiler = createCompiler(webpack, config, appName, urls, useYarn);
到:
const compiler = createCompiler({ webpack, config, appName, urls, useYarn });
这篇关于编译失败.webpack 不是一个函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!