mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-15 11:01:21 +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;
|
let importESM;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -10,6 +15,13 @@ export function dynamicImportLoaderFactory() {
|
|||||||
return importESM;
|
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) {
|
export async function tryRequireThenImport(module: string) {
|
||||||
let result;
|
let result;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user