pengx17 / vite-plugin-web-components-hmr

Provides Vite HMR for web components(vanilla, Lit, Fast, List, Haunted)

Home Page:https://www.npmjs.com/package/vite-plugin-web-components-hmr

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

šŸ«” This repository is heavily forked from @open-wc/dev-server-hmr under MIT licence, and adapting for the Vite plugin system.


Installation

# pnpm
pnpm add vite-plugin-web-components-hmr -D
# yarn
yarn add vite-plugin-web-components-hmr -D
# npm
npm i vite-plugin-web-components-hmr -D

Usage

The options for the plugin is exactly the same as @open-wc/dev-server-hmr. Check the documentation here.

// example for using with Lit

import { defineConfig } from 'vite'
import { hmrPlugin, presets } from 'vite-plugin-web-components-hmr'

export default defineConfig({
  plugins: [
    hmrPlugin({
      include: ['./src/**/*.ts'],
      presets: [presets.lit],
    }),
  ],
})

About

Provides Vite HMR for web components(vanilla, Lit, Fast, List, Haunted)

https://www.npmjs.com/package/vite-plugin-web-components-hmr

License:MIT License


Languages

Language:JavaScript 73.9%Language:TypeScript 26.1%