UNPKG

@dr.pogodin/react-utils

Version:

Collection of generic ReactJS components and utils

25 lines (24 loc) 955 B
type RequireWeakOptionsT = { basePath?: string; }; type RequireWeakResT<T> = T extends { default: infer D; } ? (D extends null | undefined ? T : D & Omit<T, 'default'>) : T; /** * Requires the specified module without including it into the bundle during * Webpack build. * @param modulePath * @param [basePath] * @return Required module. */ export declare function requireWeak<T extends object>(modulePath: string, basePathOrOptions?: string | RequireWeakOptionsT): RequireWeakResT<T> | null; /** * Resolves specified module path with help of Babel's module resolver. * Yes, the function itself just returns its argument to the caller, but Babel * is configured to resolve the first argument of resolveWeak(..) function, thus * the result will be the resolved path. * @param {string} modulePath * @return {string} Absolute or relative path to the module. */ export declare function resolveWeak(modulePath: string): string; export {};