Exciting news!Announcing our $4.6M Series Seed. Learn more
Socket
LoveBlogFAQ
Install
Log in

preact-jsx-runtime

Package Overview
Dependencies
0
Maintainers
1
Versions
4
Issues
File Explorer

Advanced tools

preact-jsx-runtime

Preact JSX runtime definition for use with automatic JSX import

    1.2.0latest

Version published
Maintainers
1
Yearly downloads
18,613
increased by242.09%

Weekly downloads

Changelog

Source

1.2.0 (2020-09-12)

Features

  • Add ES modules entrypoints.

Readme

Source

Preact JSX Runtime

This module serves as an entrypoint for automatic JSX import using Preact. It enables you to use @babel/preset-react's runtime: 'automatic' option by assigning 'preact-jsx-runtime' as the importSource option. In the future, Preact may offer this out-of-the-box.

For more information, refer to the following resources:

Installation

Because preact is defined as a peer dependency, make sure that it's installed if it is not already:

npm install preact

Then, install preact-jsx-runtime.

npm install preact-jsx-runtime

It should be installed as a regular dependency (not a development dependency), since the transformed code will import using preact-jsx-runtime as a proxy to Preact.

Usage

You will most likely want to assign this as the importSource option of @babel/preset-react.

An example Babel configuration might look like:

{ "presets": [ [ "@babel/preset-react", { "runtime": "automatic", "importSource": "preact-jsx-runtime" } ] ] }

You can also refer to the test/ directory for example Babel configuration and fixture inputs and outputs.

Or, try the live demo on Glitch.

License

Copyright 2020 Andrew Duthie

Released under the MIT License. See LICENSE.md.

Keywords

Socket

Product

Subscribe to our newsletter

Get open source security insights delivered straight into your inbox. Be the first to learn about new features and product updates.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc