[英]Error in multi app: Cannot resolve module 'babel-loader' after upgrading babel to v7
It seems I've got all that is needed installed, but still cannot make it work. 看来我已经安装了所有需要的东西,但仍然无法使它正常工作。
Here's my package.json: 这是我的package.json:
"babel-core": "^7.0.0-bridge.0",
"babel-jest": "^23.4.2",
"babel-loader": "7.1.1",
Then, I have a webpack.config.js file for configuring webpack. 然后,我有一个webpack.config.js文件,用于配置webpack。 There's the fragment that causes problems:
有导致问题的片段:
webpackConfig.module.loaders = [{
test : /\.(js|jsx)$/,
exclude : /node_modules/,
loader : 'babel-loader',
query : project.compiler_babel
}, {
test : /\.json$/,
loader : 'json'
}];
anything I type instead of 'babel-loader' as a value of loader key will be mentioned in the error message in the place of "babel-loader". 我键入的任何内容(而不是“ babel-loader”)都将在错误消息中的“ babel-loader”位置提及,而不是“ loader-key”的值。
And I also have project.config.js where the query leads: 我还拥有project.config.js,查询在其中进行:
compiler_babel : {
cacheDirectory : true,
plugins : ['transform-runtime'],
presets : ['es2015', 'react', 'stage-0']
},
I have also tried to work with babel.config.js, with configuration from compiler_babel, but did not get the way with it. 我也曾尝试使用babel.config.js进行编译,并使用了来自compiler_babel的配置,但没有找到解决方法。
Any ideas how can I make it work? 有什么想法可以使它起作用吗? I'm planning to write some test in jest for react application, therefore I need some newer babel packages.
我打算开玩笑地为React应用程序编写一些测试,因此我需要一些更新的babel软件包。
PS The precise error message: PS精确的错误消息:
ERROR in multi app Module not found: Error: Cannot resolve module 'babel-loader' in ... @ multi app
在多应用程序中找不到错误模块:错误:在... @多应用程序中无法解析模块“ babel-loader”
and my webpack version is "webpack": "^1.15.0", 而我的webpack版本是“ webpack”:“ ^ 1.15.0”,
Check the documentation . 检查文档 。 You need babel-loader v8 with Babel v7.
您需要带Babel v7的babel-loader v8。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.