Skip to content

Support __filename, __dirname, __line and additional global variables to get information about the source file with esbuild

License

Notifications You must be signed in to change notification settings

martonlederer/esbuild-plugin-fileloc

Repository files navigation

esbuild-plugin-fileloc

Support __dirname, __filename, __line and additional global variables with esbuild

Install

yarn add -D esbuild-plugin-fileloc

or

npm i -D esbuild-plugin-fileloc

Usage

There are 5 global variables available currently:

console.log(__dirname); // absolute dirname in source
console.log(__filename); // absolute filename in source
console.log(__relativedirname); // relative dirname in source
console.log(__relativefilename); // relative filename in source
console.log(__line); // line number

Typescript declarations

To add type declarations for the global variables to your project you can just add this line to your ts file:

/// <reference types="esbuild-plugin-fileloc" />

About

Support __filename, __dirname, __line and additional global variables to get information about the source file with esbuild

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published