【问题标题】:ERROR in ./node_modules/recompose/dist/Recompose.esm.js Module not found: Error: Can't resolve '@babel/runtime/helpers/builtin/es6/extends'./node_modules/recompose/dist/Recompose.esm.js 中的错误找不到模块:错误:无法解析“@babel/runtime/helpers/builtin/es6/extends”
【发布时间】:2019-01-12 20:35:40
【问题描述】:

我正在使用 laravel(5.6) 和 reactjs 和 recompose 包。但是当我运行 yarn dev 时,会出现这个错误:

我的 babelrc 代码在这里-

{
  "presets": [
    ["env"],
    "es2015",
    "react",
    "stage-2"
  ],
  "plugins": [
    "babel-plugin-transform-class-properties",
    "babel-plugin-syntax-dynamic-import",
    "babel-plugin-transform-export-extensions",
    [
      "babel-plugin-transform-runtime",
      {
        "helpers": true,
        "polyfill": false,
        "regenerator": true
      }
    ],
    [
      "babel-plugin-transform-object-rest-spread",
      {
        "useBuiltIns": true
      }
    ]
  ]
}

谁能帮我解释一下为什么会出现这个错误。

【问题讨论】:

  • 我也得到了这个..CRA 与 recompose。你找到解决方案了吗?
  • 不,我没有找到解决方案。我正在努力。
  • 你在运行什么命令?我在纱线文档yarnpkg.com/en/docs/cli 中没有看到“纱线开发”命令。也许您的意思是“纱线安装”?
  • 它的 laravel-mix package.json 默认命令用于运行 webpack。它应该用 babel 编译 jsx 文件,但给出了这个错误。当我使用 HOC 组件而不扩展 React.component 类时,它给出了错误。

标签: reactjs laravel babeljs laravel-mix recompose


【解决方案1】:

你还记得吗

import 'babel-polyfill';

在您的应用程序入口点?

如果不这样做,构建将失败。

【讨论】:

    【解决方案2】:

    recompose @0.28.x 导致 babel 构建问题;降级到0.27.1

    【讨论】:

    • 我有一个 0.28.0 但没有任何问题
    猜你喜欢
    • 2019-01-14
    • 2016-03-23
    • 2019-06-21
    • 2019-01-13
    • 2020-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-12-31
    相关资源
    最近更新 更多