我如何在 React.js 应用程序中解析 "non-configurable property "ChoiceGroupOption",我正在使用 Parcel 并从 "office-ui-fabric-react" 导入组件

How do I resolve "non-configurable property "ChoiceGroupOption" in a React.js app, I am using Parcel and imported comp from "office-ui-fabric-react"

我有一个 React 应用程序,我使用 Parcel 作为我的打包器。我想使用 "office-ui-fabric-react" 个组件。一切正常,直到我从 "office-ui-fabric-react" (Office Fabric Ui).
导入一个组件 这是我从控制台收到的错误消息 -

TypeError: can't redefine non-configurable property "ChoiceGroupOption".

我已确保安装了所有依赖项("office-UI-fabric-react" 不需要任何声明的依赖项)。
然后我设置了一个新的 React 项目,这次使用 Create-React-App 命令生成样板文件。这个版本没有任何问题,即使在从 "office-ui-fabric-react" 导入组件后,它工作正常

import { PrimaryButton } from "office-ui-fabric-react

//只需将此行添加到使用 parcel 的 Reactjs 项目中

TypeError: can't redefine non-configurable property "ChoiceGroupOption"

根据@VitalieBraga 的建议,此问题的解决方案是为每个要导入的 office-UI 反应组件引用特定模块。 例如

import { PrimaryButton } from "office-ui-fabric-react/lib/button";
import { ChoiceGroup,IChoiceGroupOption} from "office-ui-fabric-react/lib/ChoiceGroup";

这实际上解决了我遇到的问题,但是关于在一行中导入多个组件的问题,这对于 Parcel 是不可能的。

import { css, classNamesFunction, DefaultButton, IStyle, Label, PrimaryButton } from 'office-ui-fabric-react';

另一种选择是使用 Webpack 而不是 Parcel