Skip to content
This repository has been archived by the owner on Dec 31, 2023. It is now read-only.

Latest commit

 

History

History
53 lines (37 loc) · 923 Bytes

File metadata and controls

53 lines (37 loc) · 923 Bytes

babel-plugin-transform-preact-import

BPTPI for short, pronounced Bipitipy

Build and Test

This plugin adds import { h } from 'preact' to files containing JSX

Example

In

const Title = (value) => <h1>{value}</h1>

Out

import { h } from 'preact'
const Title = (value) => <h1>{value}</h1>

Installation

npm install --save-dev babel-plugin-transform-preact-import

Usage

Via .babelrc (Recommended)

{
  "plugins": [
    "transform-preact-import"
  ]
}

Via CLI

babel --plugins babel-plugin-transform-preact-import script.js

Via Node API

require("babel-core").transform("code", {
  plugins: ["transform-preact-import"]
});