简体   繁体   English

多应用程序中的错误:将babel升级到v7后无法解析模块“ babel-loader”

[英]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.

相关问题 错误:无法解析模块“babel-loader” - Error: Cannot resolve module 'babel-loader' 错误 in./src/app.js 模块构建失败(来自./node_modules/babel-loader/lib/index.js):错误:找不到模块'@babel/preset-present-env' - ERROR in ./src/app.js Module build failed (from ./node_modules/babel-loader/lib/index.js): Error: Cannot find module '@babel/preset-present-env' 未找到输入模块中的错误:错误:无法解析“babel-loader” - ERROR in Entry module not found: Error: Can't resolve 'babel-loader' 错误:Webpack 2无法解析babel-loader - Error: Webpack 2 can't resolve babel-loader 找不到模块 'babel-loader' 需要堆栈: - Cannot find module 'babel-loader' Require stack: webpack:babel-loader的语法错误 - webpack: syntax error with babel-loader babel-loader不转码且无错误 - babel-loader not transpiling and without error babel-loader错误 - TypeError:val不是函数 - babel-loader error - TypeError: val is not a function 模块构建失败(来自 ./node_modules/babel-loader/lib/index.js):错误:找不到模块“./src/data” - Module build failed (from ./node_modules/babel-loader/lib/index.js): Error: Cannot find module './src/data' 模块构建失败(来自 ./node_modules/babel-loader/lib/index.js):错误:找不到模块“babel-preset-react” - Module build failed (from ./node_modules/babel-loader/lib/index.js): Error: Cannot find module 'babel-preset-react'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM