@babel/plugin-syntax-flow
备注
Syntax only
Using this plugin directly only enables Babel to parse this syntax. If you want to remove Flow syntax then use the flow-strip-types plugin or flow preset to both parse and transform this syntax.
Installation
- npm
- Yarn
- pnpm
npm install --save-dev @babel/plugin-syntax-flow
yarn add --dev @babel/plugin-syntax-flow
pnpm add --save-dev @babel/plugin-syntax-flow
Usage
With a configuration file (Recommended)
babel.config.json
{
"plugins": ["@babel/plugin-syntax-flow"]
}
Via CLI
Shell
babel --plugins @babel/plugin-syntax-flow script.js
Via Node API
JavaScript
require("@babel/core").transformSync("code", {
plugins: ["@babel/plugin-syntax-flow"],
});