npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

vite-plugin-vscode-webview-hmr

v1.0.1

Published

Support the development of VSCode WebView with Hot Module Replacement (HMR)

Readme

Vite-plugin-vscode-webview-hmr

English | 中文

开发 vscode 的 webview 项目,使用 vite 作为构建工具时,可用 vite-plugin-vscode-webview-hmr 来实现开发模式下的热更新(HMR)。

特性

  • 零配置
  • 零适配
  • 支持单、多页面

安装

# pnpm
pnpm i vite-plugin-vscode-webview-hmr -D

# yarn
yarn add vite-plugin-vscode-webview-hmr -D

# npm
npm i vite-plugin-vscode-webview-hmr -D

使用

模式

只需在 vite.config.ts 配置文件中简单配置即可,如:

import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
import vscodeWebviewHmr from "vite-plugin-vscode-webview-hmr";

export default defineConfig({
  plugins: [vue(), vscodeWebviewHmr()],
  build: {
    outDir: "./dist",
  },
});

需要注意的是,在 vscode 的 webview 开发阶段,一般使用的是 build --watch 模式,但是使用 vite-plugin-vscode-webview-hmr 后,需要使用 serve 模式开发。在该模式下 vite-plugin-vscode-webview-hmr 会在 outDir 所指的目录下生成一个 .html 的入口文件,用于替代 build --watch 模式下生成的 .html 的入口文件。

插件配置项

  • logDir: 日志地址。可选项。有值时日志记录开始生效。用于记录插件执行过程中的一些重要的中间数据,处理 bug 时使用。
  • indexScript: 入口文件脚本。可选项。用于将自定义的<script>脚本插入到插件生成的 .html 入口文件中。
  • iframeScript: iframe 文件脚本。可选项。用于将自定义的<script>脚本插入到 serve 模式下生成的 .html 入口文件中。

示例

vue3 + vite 的单页面示例:vue-sample

vue3 + vite 的多页面示例:vue-multi-page-sample

其他示例:vscode-webview-extension-example

参考

本项目部分代码参考 vite-plugin-vscode 开发,特此感谢。