@babel/plugin-syntax-import-meta
信息
This plugin is included in @babel/preset-env
, in ES2020.
提示
You can safely remove this plugin from your Babel config if using @babel/core
7.10.0 or above.
Installation
- npm
- Yarn
- pnpm
npm install --save-dev @babel/plugin-syntax-import-meta
yarn add --dev @babel/plugin-syntax-import-meta
pnpm add --save-dev @babel/plugin-syntax-import-meta
Usage
With a configuration file (Recommended)
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"]
});