From 9ddf78ad62d23867d70692a7023ce28c93e29f27 Mon Sep 17 00:00:00 2001 From: yarastqt Date: Mon, 13 Apr 2020 15:08:06 +0300 Subject: [PATCH] feat: impl import module with interop --- src/core/import-module.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 src/core/import-module.ts 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 +}