babel-plugin-transform-import-meta
Version:
Transforms import.meta for nodejs environments
18 lines (17 loc) • 661 B
TypeScript
import type { PluginObj } from '@babel/core';
export interface PluginOptions {
module?: 'CommonJS' | 'ES6' | undefined;
}
/**
* Rewrites known `import.meta`[1] properties into equivalent non-module node.js
* expressions. In order to maintain compatibility with plugins transforming
* non-standard properties, this plugin transforms only known properties and
* does not touch expressions with unknown or without member property access.
* Properties known to this plugin:
*
* - `url`[2]
*
* [1]: https://github.com/tc39/proposal-import-meta
* [2]: https://html.spec.whatwg.org/#hostgetimportmetaproperties
*/
export default function (): PluginObj;