Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[React Intl] The Intl APIs must be available in the runtime, and do not appear to be built-in. An Intl polyfill should be loaded. #2149

Closed
beeant0512 opened this issue Sep 4, 2018 · 10 comments

Comments

@beeant0512
Copy link

beeant0512 commented Sep 4, 2018

由于有OCX插件,头部必须加上标签
<meta http-equiv="X-UA-Compatible" content="IE=5; IE=10" />

polyfills: ['ie11']

然后就报异常了
[React Intl] The Intl APIs must be available in the runtime, and do not appear to be built-in. An Intl polyfill should be loaded.
See: http://formatjs.io/guides/runtime-environments/
umi.js (56691,5)

The above error occurred in the component:
in IntlProvider (created by _default)
in LocaleProvider (created by _default)
in _default (created by _default)
in _default
in Provider (created by DvaContainer)
in DvaContainer
Consider adding an error boundary to your tree to customize error handling behavior.
Visit https://fb.me/react-error-boundaries to learn more about error boundaries.

@beeant0512
Copy link
Author

<meta http-equiv="X-UA-Compatible" content="IE=10" /> 同样有问题

@linqinghao
Copy link

在IE10下面没有Intl API, 需要polyfill. 我用下面的方法解决了。
第一步:

$ npm install --save intl @babel-polyfill

第二步:在src下新建 global.js

import '@babel/polyfill';

global.Intl = require('intl'); 
window.Intl = require('intl');

2018-09-04_142257

在IE9+上都可以跑了,不过布局都乱了。。flex布局不支持IE9以及部分支持IE10。

@xutaogit
Copy link

xutaogit commented Sep 4, 2018

@linchinghao
理论上迁移到umi之后直接改配置里的polyfills就能实现IE兼容吧,但刚在config.js文件里修改后编译是成功了,但IE控制台切到10或者9还是跑不起来。如果还是要通过安装polyfill来实现hack且布局仍然乱的,是不是表示目前版本还不可用。。。头大Orz

@JevonYang
Copy link

@xutaogit 在html模板里加入以下内容,即可简单适配有侧边栏的布局(来源ant-design某个issue)。完美适配,可能就要重新写layout了。
`<!--[if IE 9]>

<style> .ant-layout-has-sider > .ant-layout-sider { float: left; position: relative; height: 100% !important; } </style>

<![endif]-->`

@afc163
Copy link
Member

afc163 commented Sep 4, 2018

pro 不支持 IE11 以下的版本。

@taichiyi
Copy link

taichiyi commented Oct 30, 2018

纠正一下
错:$ npm install --save intl @babel-polyfill
对:$ npm install --save intl @babel/polyfill

@yutingzhao1991
Copy link
Contributor

可以配置 targets: { ie: 9 } 会加上 intl 补丁。

@drduan
Copy link

drduan commented Nov 19, 2018

华为手机端自带浏览器打开报同样错误  是否也需要引入polyfill

@pipihua666
Copy link

在IE10下面没有Intl API, 需要polyfill. 我用下面的方法解决了。
第一步:

$ npm install --save intl @babel-polyfill

第二步:在src下新建 global.js

import '@babel/polyfill';

global.Intl = require('intl'); 
window.Intl = require('intl');

2018-09-04_142257

在IE9+上都可以跑了,不过布局都乱了。。flex布局不支持IE9以及部分支持IE10。

此方法可行,ie11以下不支持Intl接口,通过这样添加intl polyfill可解决
https://formatjs.io/docs/guides/runtime-requirements

@chenyu1990
Copy link

chenyu1990 commented Jun 14, 2022

用了这个方法,鸿蒙2.0的浏览器还是一直转圈圈
md,华为浏览器没有 Notification 方法。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants