@techstack/react-lazy-named
Version:
React lazy() with named imports - exports support
20 lines (17 loc) • 468 B
JavaScript
import { get } from 'lodash-es';
import * as React from 'react';
/* eslint @typescript-eslint/no-explicit-any: 0 */
var Lazy = function Lazy(thenable, name) {
if (name === void 0) {
name = 'default';
}
return React.lazy(function () {
return thenable().then(function (mod) {
return {
"default": get(mod, name, 'ERROR EXPORT NOT FOUND')
};
});
});
};
export { Lazy as default };
//# sourceMappingURL=react-lazy-named.esm.js.map