Package Exports
- als-module-info
- als-module-info/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (als-module-info) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
als-module-info
The als-module-info
is a small function which takes the import.meta
object and returns an object with two properties: __dirname
and __filename
, representing the module's directory and the full path to the module file.
Installation
To install, use npm:
npm install als-module-info
Usage
Import the getModuleInfo
function from the package and use it in your ES6 module:
import getModuleInfo from 'als-module-info';
const {__dirname,__filename} = getModuleInfo(import.meta);
console.log(__dirname); // Outputs the directory of the module
console.log(__filename); // Outputs the path to the module file