简体   繁体   English

React & Babel:你可能需要一个额外的加载器来处理这些加载器的结果

[英]React & Babel: You may need an additional loader to handle the results of these loaders

Im working on a react app made with create-react-app , and whenever I start the app I get this error:我正在开发一个使用create-react-app ,每当我启动应用程序时,我都会收到此错误:

./node_modules/scrambles/dist/esm/scrambles.js 37:39
Module parse failed: Unexpected token (37:39)
File was processed with these loaders:
 * ./node_modules/babel-loader/lib/index.js
You may need an additional loader to handle the result of these loaders.
| 
| async function getWorker() {
>   const url = outsideStrategy.url.esm ?? outsideStrategy.url.cjs;
|   const workerInstantiator = outsideStrategy.workerInstantiator.esm ?? outsideStrategy.workerInstantiator.cjs;
|   let worker;

Here are my dependencies in package.json :这是我在package.json中的依赖项:

  "dependencies": {
    "@testing-library/jest-dom": "^5.12.0",
    "@testing-library/react": "^11.2.7",
    "@testing-library/user-event": "^12.8.3",
    "@types/node": "^15.3.0",
    "bulma": "^0.9.2",
    "react": "^17.0.2",
    "react-dom": "^17.0.2",
    "react-icons": "^4.2.0",
    "react-router-dom": "^5.2.0",
    "react-scripts": "4.0.1",
    "scrambles": "^0.1.13",
    "typescript": "^4.2.4",
    "web-vitals": "^1.1.2"
  },

Im not knowledgeable at all when it comes to bable , and based on the error, that seems to be a source of the issue.我对bable ,并且基于错误,这似乎是问题的根源。 I have tried downgrading react-scripts as another post directed, but I had no luck with that.我曾尝试按照另一篇文章的指示降级react-scripts ,但我没有运气。 Any help is greatly appreciated;任何帮助是极大的赞赏; Ive been trying to fix this for hours.几个小时以来,我一直试图解决这个问题。

It looks like this is a known issue with create react app and dependencies that use nullish coalescing.看起来这是创建反应应用程序和使用无效合并的依赖项的已知问题。 See this GitHub issue for more information https://github.com/facebook/create-react-app/issues/9468有关更多信息,请参阅此 GitHub 问题https://github.com/facebook/create-react-app/issues/9468

One of the suggested fixes is to change your browserslist config in your package.json to this:建议的修复之一是将 package.json 中的 browserslist 配置更改为:

"browserslist": [
   ">0.2%",
  "not dead",
  "not op_mini all"
],

That may fix it for you because it'll change how Babel is transpiling your code.这可能会为你解决这个问题,因为它会改变 Babel 编译你的代码的方式。 It looks like it's not transpiling any nullish coalescing because it's supported by the browserslist you're targeting.看起来它没有转换任何无效的合并,因为它受到您所定位的浏览器列表的支持。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 您可能需要一个额外的加载器来处理这些加载器的结果,r = ts(a[0]) - You may need an additional loader to handle the result of these loaders, r = ts(a[0]) “你可能需要一个额外的加载器来处理这些加载器的结果。” - "You may need an additional loader to handle the result of these loaders." Reactjs - 你可能需要一个额外的加载器来处理这些加载器的结果 - Reactjs - You may need an additional loader to handle the result of these loaders Vue - 你可能需要一个额外的加载器来处理这些加载器的结果 - Vue - You may need an additional loader to handle the result of these loaders react-script 4.0.3 显示模块解析失败:您可能需要一个额外的加载器来处理这些加载器的结果 - react-script 4.0.3 showing Module parse failed: You may need an additional loader to handle the result of these loaders Webpack 加载程序错误:您可能需要额外的加载程序来处理这些加载程序的结果 - Webpack loader error: You may need an additional loader to handle the result of these loaders Vue Render HTML - 您可能需要一个额外的加载器来处理这些加载器的结果 - Vue Render HTML - You may need an additional loader to handle the result of these loaders 模块解析失败:意外令牌。 您可能需要一个额外的加载器来处理这些加载器的结果 - Module parse failed: Unexpected token . You may need an additional loader to handle the result of these loaders 您可能需要额外的加载器来处理这些加载器在 NUXT 应用程序和 HEROKU 平台中的结果 - You may need an additional loader to handle the result of these loaders in NUXT app and HEROKU platform Vuetify - 错误“您可能需要额外的加载器来处理这些加载器的结果。” - Vuetify - Error "You may need an additional loader to handle the result of these loaders."
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM