[React Intl] Missing locale data for locale: “undefined”. Using default locale: “en” as fallback

IE10报错

[React Intl] TheIntlAPIs must be available in the runtime, and do not appear to be built-in. AnIntlpolyfill should be loaded

参考资料
https://github.com/ant-design/ant-design-pro/issues/2149
Intl 自己的polyfill. https://formatjs.io/guides/runtime-environments/

react项目的主入口文件中引入

  1. import 'intl';
  2. import 'intl/locale-data/jsonp/en';

intl是从这里来的,https://github.com/andyearnshaw/Intl.js

polyfill.js添加
参考 https://github.com/ant-design/ant-design-pro/issues/2644

  1. npm install --save intl @babel-polyfill

use

  1. import '@babel/polyfill';
  2. global.Intl = require('intl'); // 适配 nodejs
  3. window.Intl = require('intl'); // 适配浏览器

image.png