From fc8e7e790106b886ea76610a9348f55d3dac5943 Mon Sep 17 00:00:00 2001 From: xiaohuoni Date: Sun, 14 Oct 2018 20:54:33 +0800 Subject: [PATCH] add intl (#1242) * add intl Close: #1151 * fix targets * remove prod --- packages/umi-plugin-locale/package.json | 1 + packages/umi-plugin-locale/src/index.js | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/packages/umi-plugin-locale/package.json b/packages/umi-plugin-locale/package.json index c554cbdc6b57..8316525f17f6 100644 --- a/packages/umi-plugin-locale/package.json +++ b/packages/umi-plugin-locale/package.json @@ -24,6 +24,7 @@ "umi" ], "dependencies": { + "intl": "^1.2.5", "moment": "2.x", "mustache": "^2.3.0", "prop-types": "^15.6.2", diff --git a/packages/umi-plugin-locale/src/index.js b/packages/umi-plugin-locale/src/index.js index 0647ab7c6ff4..79a94cdf2672 100644 --- a/packages/umi-plugin-locale/src/index.js +++ b/packages/umi-plugin-locale/src/index.js @@ -59,6 +59,13 @@ export function getLocaleFileList(absSrcPath, singular) { export default function(api, options = {}) { const { config, paths } = api; + const { targets: { ie } = {} } = config; + + if (ie && ie <= 10) { + api.addEntryPolyfillImports({ + source: 'intl', + }); + } api.addPageWatcher( join(paths.absSrcPath, config.singular ? 'locale' : 'locales'),