From 88b85407e90f2cc42aabf620522f54f725f886b6 Mon Sep 17 00:00:00 2001 From: afc163 Date: Sat, 1 Sep 2018 23:30:22 +0800 Subject: [PATCH] Add loading component for dynamicImport --- config/config.js | 4 +++- src/components/PageLoading/index.js | 10 ++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 src/components/PageLoading/index.js diff --git a/config/config.js b/config/config.js index fab44a84..b73a21df 100644 --- a/config/config.js +++ b/config/config.js @@ -19,7 +19,9 @@ export default { default: 'zh-CN', // default zh-CN baseNavigator: true, // default true, when it is true, will use `navigator.language` overwrite default }, - dynamicImport: true, + dynamicImport: { + loadingComponent: './components/PageLoading/index', + }, polyfills: ['ie11'], ...(!process.env.TEST && os.platform() === 'darwin' ? { diff --git a/src/components/PageLoading/index.js b/src/components/PageLoading/index.js new file mode 100644 index 00000000..77c0f165 --- /dev/null +++ b/src/components/PageLoading/index.js @@ -0,0 +1,10 @@ +import React from 'react'; +import { Spin } from 'antd'; + +// loading components from code split +// https://umijs.org/plugin/umi-plugin-react.html#dynamicimport +export default () => ( +
+ +
+); -- GitLab