@babel/plugin-syntax-import-meta

syntax-import-meta - 图1info

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

syntax-import-meta - 图2tip

You can safely remove this plugin from your Babel config if using @babel/core 7.10.0 or above.

Installation

  • npm
  • Yarn
  • pnpm
  1. npm install --save-dev @babel/plugin-syntax-import-meta
  1. yarn add --dev @babel/plugin-syntax-import-meta
  1. pnpm add --save-dev @babel/plugin-syntax-import-meta

Usage

babel.config.json

  1. {
  2. "plugins": ["@babel/plugin-syntax-import-meta"]
  3. }

Via CLI

Shell

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

Via Node API

JavaScript

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