1.0.2 • Published 1 year ago
@cli-dang/async-import-meta-resolve v1.0.2
@cli-dang/async-import-meta-resolve
async import.meta.resolve for node v20. ESModule.
Index of Contents
Description
ℹ This feature is only available with the --experimental-import-meta-resolve command flag enabled.
Since Node v20 import.meta.resolve is no more a Promise|
AsyncFunction
more @ NodeJS API Docs
Installation
npm install @cli-dang/async-import-meta-resolve
Usage
Let's say we need to know if the package lodash
is installed.
import { async_import_meta_resolve } from 'async-import-meta-resolve'
let lodash_is_installed: string | Error = await async_import_meta_rosolve('lodash').catch(error=>error)
if(lodhash_is_installed instanceof Error)
console.error('lodash not found')
else console.log(`lodash found and its location is -> ${lodash_is_installed}`)
JetBrains OSS License
I want to thank JetBrains to grant me the Open Source Software license for all their products. This opportunity gives me
strength to keep on going with my studies and personal project.
To learn more about this opportunity, have a look
at Licenses for Open Source Development - Community Support.
Thank you