【问题标题】:SCRIPT438: Object doesn't support property or method 'setPrototypeOf'SCRIPT438:对象不支持属性或方法“setPrototypeOf”
【发布时间】:2026-01-21 02:45:02
【问题描述】:

我使用“create-react-app”命令创建了一个反应应用程序并更新了 package.json 中的所有包,应用程序在 IE(任何版本)中无法运行,但在添加 @babel/polyfil 依赖项后,它可以使用IE-11,但面临 IE-10 和旧版本的问题。 SCRIPT438:对象不支持属性或方法“setPrototypeOf”

【问题讨论】:

    标签: reactjs create-react-app


    【解决方案1】:

    创建 React 应用程序需要 polyfill 才能在 Internet Explorer 上运行。您应该按照the official guide 使其在 IE 9、10 或 11 上运行。在撰写本文时,它需要以下步骤:

    通过npmyarn 安装react-app-polyfill

    npm install react-app-polyfill
    

    在你的代码中导入它:

    import 'react-app-polyfill/ie9';
    // or
    import 'react-app-polyfill/ie11';
    

    【讨论】: