即使使用Polyfill,React应用也无法在IE 11中呈现 [英] React app not rendering in IE 11 even with polyfills

查看:85
本文介绍了即使使用Polyfill,React应用也无法在IE 11中呈现的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个完整的React应用程序,我想在IE 11上进行部署,但是除了白纸之外没有成功.

I have a fully built React application that I would like to deploy on IE 11, but been having no success but a white page.

为了进行测试,我使用npx create-react-app创建了一个虚拟应用程序,并尝试在IE 11/Edge上启动.安装"react-app-polyfill"并在第1行和第2行中的"react-app-polyfill/ie11"和"react-app-polyfill/stable"上导入.在index.js的2中,我还在package.json文件内的browserlist.development中包括了最后1个版本".

For the sake of testing, I created a dummy app using npx create-react-app and attempted to launch on IE 11/Edge. Installing 'react-app-polyfill' and importing on 'react-app-polyfill/ie11' and 'react-app-polyfill/stable' on line 1 & 2 of index.js, I also included "last 1 ie version" in the browserlist.development inside the package.json file.

每个在线资源都指向需要在Windows IE 11上可见的polyfill的响应,但是我没有取得任何成功.任何指针都非常感谢!

Every resource online points to react needing polyfill to be viewable on IE 11 but I haven't had any success. Any pointers greatly appreciated!

推荐答案

您的反应脚本是什么版本?该问题很可能与 react-scripts 版本3.3.0有关.您可以在GitHub中找到许多问题报告,例如: IE11支持不起作用在开发人员模式下,即使添加了所有polyfill并启用了ie11支持为什么使用create-react-app创建的应用程序不能在IE浏览器中使用?.

What is your react-scripts version? The issue is most likely related to react-scripts version 3.3.0. You could find many issue reports in GitHub, for example: IE11 support doesn't work in dev mode, even after adding all polyfills and enabling ie11 support, Why application created using create-react-app is not working in IE browser?.

它仍然可以与 react-scripts@3.2.0 一起使用.您可以尝试恢复到3.2.0作为解决方法.还请记住删除 node_modules 中的 .cache 文件夹并删除IE浏览器缓存,然后重试.

It can still work with react-scripts@3.2.0. You could try to revert back to 3.2.0 as a workaround. Please also remember to delete .cache folder in node_modules and delete IE browser cache then try again.

这篇关于即使使用Polyfill,React应用也无法在IE 11中呈现的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆