Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bash-archive/babel-plugin-transform-preact-import
Imports preact for files containing jsx
https://github.com/bash-archive/babel-plugin-transform-preact-import
babel preact
Last synced: 3 months ago
JSON representation
Imports preact for files containing jsx
- Host: GitHub
- URL: https://github.com/bash-archive/babel-plugin-transform-preact-import
- Owner: bash-archive
- License: mit
- Archived: true
- Created: 2017-06-05T18:47:43.000Z (over 7 years ago)
- Default Branch: main
- Last Pushed: 2022-07-27T09:31:23.000Z (over 2 years ago)
- Last Synced: 2024-10-08T06:42:47.808Z (3 months ago)
- Topics: babel, preact
- Language: JavaScript
- Homepage:
- Size: 85.9 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# babel-plugin-transform-preact-import
*BPTPI for short, pronounced Bipitipy*[![Build and Test](https://github.com/bash/babel-plugin-transform-preact-import/actions/workflows/build.yml/badge.svg)](https://github.com/bash/babel-plugin-transform-preact-import/actions/workflows/build.yml)
> This plugin adds `import { h } from 'preact'` to files containing JSX
## Example
**In**
```js
const Title = (value) =>{value}
```**Out**
```js
import { h } from 'preact'
const Title = (value) =>{value}
```## Installation
```
npm install --save-dev babel-plugin-transform-preact-import
```## Usage
### Via `.babelrc` (Recommended)
```json
{
"plugins": [
"transform-preact-import"
]
}
```### Via CLI
```
babel --plugins babel-plugin-transform-preact-import script.js
```### Via Node API
```js
require("babel-core").transform("code", {
plugins: ["transform-preact-import"]
});
```