0.0.3 • Published 11 months ago

@farmfe/js-plugin-babel v0.0.3

Weekly downloads
-
License
MIT
Repository
-
Last release
11 months ago

@farmfe/js-plugin-babel

farm plugin which support use babel

Install

npm i @farmfe/js-plugin-babel -D

or yarn/pnpm

pnpm i @farmfe/js-plugin-babel -D

Usage

// farm.config.ts
import { babel } from "@farmfe/js-plugin-babel";
import react from "@farmfe/plugin-react";

defineConfig({
  plugins: [
    // transform by babel, default transform `js`, `jsx`, `ts`, `tsx` files
    babel(),
    // transform react
    react(),
  ],
});

Options

filters

  • Type: { moduleTypes: ModuleType[], resolvedPaths: string[] }
  • Default:
{
    moduleTypes: ["js", "jsx", "ts", "tsx"],
    resolvedPaths: []
}

Determines which files to transform

For example, files with the tsx extension

{
  resolvedPaths: [".tsx$"];
}

Or use module types to distinguish

{
  moduleTypes: ["tsx", "jsx"];
}

The type comes from the return value of the load hook and can be customized (farm has some default types js, jsx, ts, tsx, css, html, asset, runtime that can be used directly)

transformOptions

Babel transform configuration

priority

  • Type: number
  • Default: 99

The priority of the farm plugin execution, the higher the priority, the earlier it executes.

name

  • Type: string
  • Default: js-plugin:babel

The name of the farm plugin

0.0.3

11 months ago

0.0.2

11 months ago

0.0.1

12 months ago