@commenthol/preact-preset-vite

Preact preset for the vite bundler

Usage no npm install needed!

<script type="module">
  import commentholPreactPresetVite from 'https://cdn.skypack.dev/@commenthol/preact-preset-vite';
</script>

README

@preact/preset-vite

An all in one preset for writing Preact apps with the vite bundler.

Features:

Installation

First intall the preset package from npm:

npm install --save-dev @preact/preset-vite
# or
yarn add -D @preact/preset-vite

Enhance your vite config with the Preact preset plugin in your vite.config.ts or vite.config.js:

import { defineConfig } from "vite";
import preact from "@preact/preset-vite";

export default defineConfig({
  plugins: [preact()]
});

Options

Options can be passed to our preset plugin via the first argument:

export default defineConfig({
  plugins: [
    preact({ 
      devtoolsInProd: true,
      jsxInject: ''
    })
  ]
});

Available options

Option Type Default Description
devtoolsInProd boolean false Inject devtools bridge in production bundle instead of only in development mode
jsxInject string undefined Overwrite the default esbuild jsxInject option. To disable injection set { jsxInject: ''}

License

MIT, see the license file.