Skip to main content

@babel/plugin-syntax-import-meta

NOTE: This plugin is included in @babel/preset-env, in ES2020

Installation

npm install --save-dev @babel/plugin-syntax-import-meta

Usage

babel.config.json
{
"plugins": ["@babel/plugin-syntax-import-meta"]
}

Via CLI

Shell
babel --plugins @babel/plugin-syntax-import-meta script.js

Via Node API

JavaScript
require("@babel/core").transformSync("code", {
plugins: ["@babel/plugin-syntax-import-meta"]
});