umeta

0.2.4 • Public • Published

µmeta

Build Status Coverage Status

A micro helper for import.meta data.

import umeta from 'umeta';
 
const {dirName, fileName, require} = umeta(import.meta);

The dirName and fileName respectively represent __dirname and __filename, while the require utility helps importing conditionally, or on demand, CommonJS friendly modules.

How to transform import.meta for CommonJS ?

There are at least two options:

  • ascjs, based on @babel/parser
  • ucjs, based on @babel/core and with minimal dependencies (compatible with dynamic import(...) too)

Package Sidebar

Install

npm i umeta

Weekly Downloads

39

Version

0.2.4

License

ISC

Unpacked Size

3.28 kB

Total Files

6

Last publish

Collaborators

  • webreflection