2.2.0 • Published 3 years ago

@commenthol/preact-preset-vite v2.2.0

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

@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

OptionTypeDefaultDescription
devtoolsInProdbooleanfalseInject devtools bridge in production bundle instead of only in development mode
jsxInjectstringundefinedOverwrite the default esbuild jsxInject option. To disable injection set { jsxInject: ''}

License

MIT, see the license file.