diff --git a/public/react/config-overrides.js b/public/react/config-overrides.js index 6d03f48f9..487fbfbbf 100644 --- a/public/react/config-overrides.js +++ b/public/react/config-overrides.js @@ -14,7 +14,7 @@ const ModuleScopePlugin = require('react-dev-utils/ModuleScopePlugin'); module.exports = override( disableEsLint(), - //addBundleVisualizer(), + addBundleVisualizer(), addWebpackAlias({ "educoder": path.resolve(__dirname, 'src/common/educoder.js') }), diff --git a/public/react/dist/report.html b/public/react/dist/report.html index 60e9c63b0..71f7c738f 100644 --- a/public/react/dist/report.html +++ b/public/react/dist/report.html @@ -3,7 +3,7 @@ - h5 [12 Mar 2020 at 0:41] + h5 [12 Mar 2020 at 9:45] diff --git a/public/react/src/CustomLoadable.js b/public/react/src/CustomLoadable.js deleted file mode 100644 index b6a0ec4da..000000000 --- a/public/react/src/CustomLoadable.js +++ /dev/null @@ -1,12 +0,0 @@ -import { Loadable } from 'educoder'; - -import Loading from "./Loading"; - -const CustomLoadable = (loader, loading = Loading) => { - return Loadable({ - loader, - loading - }) -} - -export default CustomLoadable \ No newline at end of file diff --git a/public/react/src/common/educoder.js b/public/react/src/common/educoder.js index 8797fad3b..2f7aea514 100644 --- a/public/react/src/common/educoder.js +++ b/public/react/src/common/educoder.js @@ -73,8 +73,9 @@ export { default as NoneData } from '../modules/courses/coursesPublic/NoneData' export { default as WordNumberTextarea } from '../modules/modals/WordNumberTextarea' import loadable from '@loadable/component' +import defaultLoading from '../Loading' -export function Loadable({ loader, loading }) { +export function Loadable({ loader, loading = defaultLoading }) { return loadable(loader, { fallback: loading }) diff --git a/public/react/src/modules/ecs/EcSetting/index.js b/public/react/src/modules/ecs/EcSetting/index.js index c572e62f4..4989c562e 100644 --- a/public/react/src/modules/ecs/EcSetting/index.js +++ b/public/react/src/modules/ecs/EcSetting/index.js @@ -5,7 +5,6 @@ import axios from 'axios'; import './index.less'; -import CustomLoadable from "../../../CustomLoadable"; import { Loadable } from 'educoder'; import Loading from "../../../Loading"; const { Step } = Steps; diff --git a/public/react/src/modules/ecs/Ecs.js b/public/react/src/modules/ecs/Ecs.js index e09d90fb4..001775ff9 100644 --- a/public/react/src/modules/ecs/Ecs.js +++ b/public/react/src/modules/ecs/Ecs.js @@ -2,12 +2,12 @@ import React from 'react'; import { Switch, Route } from 'react-router-dom'; import { SnackbarHOC } from 'educoder'; -import CustomLoadable from "../../CustomLoadable"; +import { Loadable } from 'educoder' import TPMIndexHOC from "../tpm/TPMIndexHOC"; -const Home = CustomLoadable(() => import('./Home/index')); -const EcYear = CustomLoadable(() => import('./EcYear/index')); -const EcSetting = CustomLoadable(() => import('./EcSetting/index')); +const Home = Loadable({ loader: () => import('./Home/index') }); +const EcYear = Loadable({ loader: () => import('./EcYear/index') }); +const EcSetting = Loadable({ loader: () => import('./EcSetting/index') }); const $ = window.$ //工程认证各个页面的查看详情弹层 diff --git a/public/react/src/modules/help/Help.js b/public/react/src/modules/help/Help.js index 2d627dc4f..dc4481697 100644 --- a/public/react/src/modules/help/Help.js +++ b/public/react/src/modules/help/Help.js @@ -1,20 +1,18 @@ import React from 'react'; -import PropTypes from 'prop-types'; import { Switch, Route, Link } from 'react-router-dom'; import { Affix, Menu, Row, Col } from "antd"; import { SnackbarHOC } from 'educoder'; import './Help.css'; - -import CustomLoadable from "../../CustomLoadable"; +import { Loadable } from 'educoder' import TPMIndexHOC from "../tpm/TPMIndexHOC"; -const AboutUs = CustomLoadable(() => import('./AboutUs')); -const ContactUs = CustomLoadable(() => import('./ContactUs')); -const Cooperatives = CustomLoadable(() => import('./Cooperatives')); -const Agreement = CustomLoadable(() => import('./Agreement')); -const HelpCenter = CustomLoadable(() => import('./HelpCenter')); -const Feedback = CustomLoadable(() => import('./Feedback')); +const AboutUs = Loadable({ loader: () => import('./AboutUs') }); +const ContactUs = Loadable({ loader: () => import('./ContactUs') }); +const Cooperatives = Loadable({ loader: () => import('./Cooperatives') }); +const Agreement = Loadable({ loader: () => import('./Agreement') }); +const HelpCenter = Loadable({ loader: () => import('./HelpCenter') }); +const Feedback = Loadable({ loader: () => import('./Feedback') }); class Help extends React.Component { constructor(props) {