Альтернативы для System.import - PullRequest
0 голосов
/ 30 апреля 2019

После обновления веб-пакета 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'),
 )}
/>

1 Ответ

0 голосов
/ 30 апреля 2019
import('path/...and/some/more/to/get/over/the/character/limit')
...