После обновления веб-пакета System.import начинает отображать ошибку устаревания.
if (typeof System === 'undefined' || typeof System.import ===
'undefined') {
global.System = {};
System.import = module => Promise.resolve(require(module));
}
Ниже приведен loadRoute:
function loadRoute(routePromise, reducerPromises = null) {
return () => {
routePromise = routePromise
.then(module => (module.default ? module.default : module))
.catch(err => console.error('Dynamic page loading failed', err));
if (reducerPromises === null) {
return routePromise;
}
return injectReducerAndRender(reducerPromises, routePromise);
};
}
Маршрут
<Route
path="configuration/school-setup"
getComponent={loadRoute(
System.import('./modules/Configuration/pages/SchoolSetup/SchoolSetup'),
)}
/>