babel-plugin-transform-import-meta
TypeScript icon, indicating that this package has built-in type declarations

2.2.1 • Public • Published

babel-plugin-transform-import-meta

Transforms import.meta for nodejs environments. This plugin replaces any occurrence of import.meta.url.

console.log(import.meta.url);

With this

console.log(require('url').pathToFileURL(__filename).toString());

Installation

Install this package

npm install --save-dev babel-plugin-transform-import-meta

And configure it

{
  "plugins": [
    "babel-plugin-transform-import-meta"
  ]
}

Settings

ES6 modules

It's possible to use ES6 modules for the output. Useful to delegate module transformation to other plugins.

{
  "plugins": [
    ["babel-plugin-transform-import-meta", { "module": "ES6" }]
  ]
}

Credits

Based on a previous project "babel-plugin-import-meta" by The Polymer Authors

Versions

Current Tags

Version History

Package Sidebar

Install

npm i babel-plugin-transform-import-meta

Weekly Downloads

178,453

Version

2.2.1

License

BSD

Unpacked Size

12.7 kB

Total Files

6

Last publish

Collaborators

  • javiertury