React 和 core-js 无法为 IE10 进行 polyfill

问题描述

问题

出于某种原因,我的 React 应用在发布到公司的 DNS 时以文档模式 IE 10 作为标准运行。我无法控制的奇怪管理设置。

无论如何,需要支持 IE 10。在 IE 11 中它运行良好,使用建议的 Second_error:

import 'react-app-polyfill/ie11';
import 'react-app-polyfill/stable';

然后,尝试使用 ie9 而不是 ie11。没有成功,应用程序崩溃了。 polyfill 没用吗?我收到了很多错误消息,例如:

Unhandled promise rejection Error: Minified React error #31; visit https://reactjs.org/docs/error-decoder.html?invariant=31&args[]=object%20with%20keys%20%7B%7D&args[]= for the full message or use the non-minified dev environment for full errors and additional helpful warnings.
   "Unhandled promise rejection"
   {
      [functions]:,description: "Minified React error #31; visit https://reactjs.org/docs/error-decoder.html?invariant=31&args[]=object%20with%20keys%20%7B%7D&args[]= for the full message or use the non-minified dev environment for full errors and additional helpful warnings.",message: "Minified React error #31; visit https://reactjs.org/docs/error-decoder.html?invariant=31&args[]=object%20with%20keys%20%7B%7D&args[]= for the full message or use the non-minified dev environment for full errors and additional helpful warnings.",name: "Error",stack: "Error: Minified React error #31; visit https://reactjs.org/docs/error-decoder.html?invariant=31&args[]=object%20with%20keys%20%7B%7D&args[]= for the full message or use the non-minified dev environment for full errors and additional helpful warnings.
   at _o (https://the-company's-domain.com/static/js/2.517170ee.chunk.js:2:559477)
   at Anonymous function (https://the-company's-domain.com/static/js/2.517170ee.chunk.js:2:564365)
   at Ra (https://the-company's-domain.com/static/js/2.517170ee.chunk.js:2:573836)
   at gs (https://the-company's-domain.com/static/js/2.517170ee.chunk.js:2:614144)
   at cu (https://the-company's-domain.com/static/js/2.517170ee.chunk.js:2:604884)
   at su (https://the-company's-domain.com/static/js/2.517170ee.chunk.js:2:604812)
   at Zs (https://the-company's-domain.com/static/js/2.517170ee.chunk.js:2:601824)
   at Anonymous function (https://the-company's-domain.com/static/js/2.517170ee.chunk.js:2:553207)
   at t.unsta",Symbol()_a.ycgs6yczz5z: undefined,Symbol()_m.ycgs6yczz5z: undefined,Symbol(extensions)_16.ycgs6yczzi: undefined,Symbol(foo)_1a.ycgs6yczzi: undefined,Symbol(foo)_17.ycgs6yczzi: undefined,Symbol(foo)_18.ycgs6yczzi: undefined,Symbol(foo)_19.ycgs6yczzi: undefined,Symbol(meta)_2.ycgs6yczz8v: { },Symbol(nodejs.util.inspect.custom)_15.ycgs6yczzi: undefined,Symbol(react.async_mode)_11.ycgs6yczzi: undefined,Symbol(react.block)_10.ycgs6yczzi: undefined,Symbol(react.concurrent_mode)_y.ycgs6yczziy: undefined,Symbol(react.context)_t.ycgs6yczz5z: undefined,Symbol(react.element)_n.ycgs6yczz5z: undefined,Symbol(react.forward_ref)_u.ycgs6yczz5z: undefined,Symbol(react.fragment)_p.ycgs6yczz5z: undefined,Symbol(react.fundamental)_12.ycgs6yczzi: undefined,Symbol(react.lazy)_x.ycgs6yczziy: undefined,Symbol(react.memo)_w.ycgs6yczziy: undefined,Symbol(react.portal)_o.ycgs6yczz5z: undefined,Symbol(react.profiler)_r.ycgs6yczz5z: undefined,Symbol(react.provider)_s.ycgs6yczz5z: undefined,Symbol(react.responder)_13.ycgs6yczzi: undefined,Symbol(react.scope)_14.ycgs6yczzi: undefined,Symbol(react.strict_mode)_q.ycgs6yczz5z: undefined,Symbol(react.suspense)_v.ycgs6yczz5z: undefined,Symbol(react.suspense_list)_z.ycgs6yczziy: undefined
   }

很难理解缩小的包,因为我只能在现场复制这个问题,而不是在开发中(create-react-app 中的某些依赖项不适用于 polyfill + 热重载)。此链接 react-app-polyfills 导致:

Objects are not valid as a React child (found: object with keys {}). If you meant to render a collection of children,use an array instead.

这让我相信这与 Object 上的 polyfill 不成功有关....(我错了,请阅读下面的答案)

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)