From 9515cef21d799811074830116feef64ab7ef1497 Mon Sep 17 00:00:00 2001 From: ycjcl868 <45808948@qq.com> Date: Wed, 18 Sep 2019 19:07:17 +0800 Subject: [PATCH 1/3] fix: site ssr react-intl --- site/theme/template/Layout/index.jsx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/site/theme/template/Layout/index.jsx b/site/theme/template/Layout/index.jsx index 5f4cd3cdb3..7dd8311cd1 100644 --- a/site/theme/template/Layout/index.jsx +++ b/site/theme/template/Layout/index.jsx @@ -2,6 +2,9 @@ import React from 'react'; import ReactDOM from 'react-dom'; import PropTypes from 'prop-types'; import { enquireScreen } from 'enquire-js'; +import '@formatjs/intl-relativetimeformat/polyfill'; +import '@formatjs/intl-relativetimeformat/dist/locale-data/zh'; +import '@formatjs/intl-relativetimeformat/dist/locale-data/en'; import { IntlProvider } from 'react-intl'; import { Helmet } from 'react-helmet'; import 'moment/locale/zh-cn'; From 33afa7462cec3b3b98596b1dc6e1ac90ee392674 Mon Sep 17 00:00:00 2001 From: ycjcl868 <45808948@qq.com> Date: Wed, 18 Sep 2019 19:09:21 +0800 Subject: [PATCH 2/3] :memo: comment --- site/theme/template/Layout/index.jsx | 1 + 1 file changed, 1 insertion(+) diff --git a/site/theme/template/Layout/index.jsx b/site/theme/template/Layout/index.jsx index 7dd8311cd1..41589f4294 100644 --- a/site/theme/template/Layout/index.jsx +++ b/site/theme/template/Layout/index.jsx @@ -2,6 +2,7 @@ import React from 'react'; import ReactDOM from 'react-dom'; import PropTypes from 'prop-types'; import { enquireScreen } from 'enquire-js'; +// https://github.com/formatjs/react-intl/issues/1487 import '@formatjs/intl-relativetimeformat/polyfill'; import '@formatjs/intl-relativetimeformat/dist/locale-data/zh'; import '@formatjs/intl-relativetimeformat/dist/locale-data/en'; From 6d9d04db29a03ed33059cd6b49e82b8ab07a6877 Mon Sep 17 00:00:00 2001 From: ycjcl868 <45808948@qq.com> Date: Wed, 18 Sep 2019 19:21:16 +0800 Subject: [PATCH 3/3] upd: devDeps --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index fd64a0a59c..dfca8c652c 100644 --- a/package.json +++ b/package.json @@ -143,6 +143,7 @@ "devDependencies": { "@ant-design/colors": "^3.1.0", "@ant-design/tools": "^8.0.4", + "@formatjs/intl-relativetimeformat": "^4.0.1", "@packtracker/webpack-plugin": "^2.0.1", "@sentry/browser": "^5.4.0", "@types/classnames": "^2.2.8",