Skip to content

Commit

Permalink
fix: ensure that pure esm modules without main can be imported (close
Browse files Browse the repository at this point in the history
  • Loading branch information
ElMassimo committed Apr 7, 2023
1 parent d1faa4e commit f48530c
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions packages/iles/src/node/plugin/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,12 @@ export async function tryInstallModule (name: string) {
}

export async function importLibrary<T> (pkgName: string) {
const pkgPath = await tryInstallModule(pkgName)
return await importModule(pkgPath)
try {
const pkgPath = await tryInstallModule(pkgName)
return await importModule(pkgPath)
} catch (error) {
return await importModule(pkgName)
}
}

async function withSpinner<T> (message: string, fn: () => Promise<T>) {
Expand Down

0 comments on commit f48530c

Please sign in to comment.