diff --git a/src/core/import-module.ts b/src/core/import-module.ts new file mode 100644 index 0000000..ff4006f --- /dev/null +++ b/src/core/import-module.ts @@ -0,0 +1,10 @@ +/** + * Import module with esm interop. + * + * @param path Module path. + * @return Promise with data. + */ +export async function importModule(path: string): Promise { + const maybeModule = await import(path) + return maybeModule.default || maybeModule +}