美文网首页
React 兼容IE11语法错误的解决方法

React 兼容IE11语法错误的解决方法

作者: Mooners | 来源:发表于2020-03-03 21:50 被阅读0次

首先安装react-app-polyfill

然后在src/index.js的最顶端引入两个文件

import "react-app-polyfill/ie11";
import "react-app-polyfill/stable";
image.png

package.json中找到browserslist添加ie 11

image.png

此时Dev环境可能依然存在问题,继续设置
react-dev-utils中找到webpackHotDevClient.js文件,添加参数slashes:true

image.png

cnpm start运行看看吧~

相关文章

网友评论

      本文标题:React 兼容IE11语法错误的解决方法

      本文链接:https://www.haomeiwen.com/subject/uyypoctx.html