mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-15 02:54:11 +08:00
chore: comments and types
This commit is contained in:
@ -1,4 +1,9 @@
|
||||
export function dynamicImportLoaderFactory() {
|
||||
type ModuleLoader = (id: string) => Promise<any>;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
function dynamicImportLoaderFactory(): ModuleLoader | null {
|
||||
let importESM;
|
||||
|
||||
try {
|
||||
@ -10,6 +15,13 @@ export function dynamicImportLoaderFactory() {
|
||||
return importESM;
|
||||
}
|
||||
|
||||
/**
|
||||
* Utility to interop with both cjs and esm modules, using require() before
|
||||
* falling back to import() in case the target is an esm module.
|
||||
*
|
||||
* @param module String
|
||||
* @returns
|
||||
*/
|
||||
export async function tryRequireThenImport(module: string) {
|
||||
let result;
|
||||
|
||||
|
Reference in New Issue
Block a user