1.0.0 • Published 2 years ago

satori-jsx v1.0.0

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

satori-jsx

Use JSX with Satori without React

Install

npm install satori-jsx

Usage

Vite

import satori from 'satori-jsx/vite'

export default {
  plugins: [satori()]
}

If you're using typescript, make sure to add the following to your tsconfig.json:

{
  "compilerOptions": {
    "jsx": "preserve",
  }
}

Babel

npm install -D @babel/plugin-syntax-jsx @babel/plugin-transform-react-jsx

Update your .babelrc

{
  "plugins": [
    "@babel/plugin-syntax-jsx",
    [
      "@babel/plugin-transform-react-jsx",
      {
        "runtime": "automatic",
        "importSource": "satori-jsx"          
      }
    ]
  ]
}

Typescript

For JSX types, it's best to use react's.

npm install -D @types/react @types/react-dom