在 npm 构建期间找不到模块 @restart/context/forwardRef

Cannot find module @restart/context/forwardRef during npm build

我最近在升级到更新版本的 react-bootstrap (1.0.0-beta.6) 后开始遇到 npm build 问题。

Creating an optimized production build...
Failed to compile.

Cannot find module: '@restart/context/forwardRef'. Make sure this package is installed.
./node_modules/react-bootstrap/es/ThemeProvider.js

You can install this package by running: yarn add @restart/context/forwardRef.

我尝试了 运行 提供的 yarn 命令,但这不是有效的包名称。有谁知道如何在不返回旧版本(不支持标签,这是我正在使用的东西)的情况下解决这个问题?

这是 @restart/context 的上游问题,它刚刚发布了一个中断导入 forwardRef 的版本,如下所示:

import forwardRef from '@restart/context/forwardRef'

快速修复是通过 运行 yarn add @restart/context@2.1.2.

降级到 2.1.2

长期修复是等待 react-bootstrap 修复他们的导入或将他们的 package.json 锁定到这个版本的 @restart/context

编辑:我在 react-bootstrap 仓库中添加了一个问题来跟踪进度:https://github.com/react-bootstrap/react-bootstrap/issues/3576