跳到主要内容
FarmFarm
Version: 2.x(最新)
本页目录

@farmfe/js-plugin-babel

JavaScript plugin that runs Babel on matched Farm modules.

Installation

javascript
npm install @farmfe/js-plugin-babel --save-dev
javascript
yarn add @farmfe/js-plugin-babel --dev
javascript
pnpm add @farmfe/js-plugin-babel --save-dev

Usage

ts
import { defineConfig } from "@farmfe/core";
import { babel } from "@farmfe/js-plugin-babel";

export default defineConfig({
  plugins: [
    babel({
      priority: 99,
      transformOptions: {
        presets: ["@babel/preset-env"],
      },
    }),
  ],
});

Options

  • filters?: { moduleTypes?: ModuleType[]; resolvedPaths?: string[] } — modules to transform. Defaults to module types ["js", "jsx", "ts", "tsx"] and no path filters.
  • transformOptions?: TransformOptions — passed to Babel transformAsync with filename set to the module id.
  • priority: number — Farm plugin priority. babel() defaults to 99; include this option when passing an options object.
  • name?: string — Farm plugin name. Defaults to "js-plugin:babel".
100%

Drag or pinch to explore. Keyboard: + / − zoom, arrows pan, 0 resets, Esc closes.