https://github.com/ratson/esmeta
Handy function to handle import.meta
https://github.com/ratson/esmeta
esm esmodules import-meta meta node10
Last synced: about 1 year ago
JSON representation
Handy function to handle import.meta
- Host: GitHub
- URL: https://github.com/ratson/esmeta
- Owner: ratson
- Created: 2018-04-25T17:25:46.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2018-05-02T12:08:37.000Z (almost 8 years ago)
- Last Synced: 2025-03-02T13:17:15.368Z (about 1 year ago)
- Topics: esm, esmodules, import-meta, meta, node10
- Language: JavaScript
- Size: 4.88 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# esmeta
Handy function to handle `import.meta`
## Installation
```
npm install esmeta --save
```
## Usage
```js
import esmeta from 'esmeta'
const importMeta = esmeta(import.meta)
/*
{
url: "file:///a/b/c.mjs" // same as `import.meta.url`
dirname: "/a/b"
filename: "/a/b/c.mjs"
dirnameJoin(...paths) // helper function to join path
isMain() // return true if match to `process.mainModule`
resolve() // return the resolved filename like `require.resolve`
}
*/
```
## Related
- [is-main](https://github.com/ratson/is-main) - Check if current module is main module.