更新Webpack后,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'),
)}
/>
答案 0 :(得分:0)
import('path/...and/some/more/to/get/over/the/character/limit')