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-vue-template-inspector

v0.1.4

Published

Vite/Webpack plugin: Alt+click Vue template elements to copy the source path or open it in your editor.

Readme

vite-plugin-vue-template-inspector

GitHub

开发插件:在页面上 Alt + 左键 点击 Vue 模板节点,弹出源码路径,可复制或在本地编辑器中打开。

支持 Vite 与 Webpack 5(Vue 2 / Vue 3)。仅开发态生效,不会进入生产构建。

乾坤子应用里会用 __INJECTED_PUBLIC_PATH_BY_QIANKUN__ 把「打开编辑器」请求打到子应用的 dev server,而不是主应用域名。

安装

pnpm add -D vite-plugin-vue-template-inspector
# 或
npm i -D vite-plugin-vue-template-inspector

本地未发布时:

pnpm add -D ../vite-plugin-vue-template-inspector
# 或 npm i -D --legacy-peer-deps file:../vite-plugin-vue-template-inspector

Vite

插件需要放在 @vitejs/plugin-vue 之前,才能在编译前给模板打上定位属性。

import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import { vueTemplateInspector } from 'vite-plugin-vue-template-inspector'

export default defineConfig({
  plugins: [
    vueTemplateInspector({
      enable: true,
      start: 'code',
    }),
    vue(),
  ],
})

Webpack 5

需要 vue-loader(15 或 17)、html-webpack-plugin、webpack-dev-server。不必手写 loader rule,插件会在 vue-loader 前插入 pre-loader。只加在开发配置里即可。

const { VueLoaderPlugin } = require('vue-loader')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const { VueTemplateInspectorWebpackPlugin } =
  require('vite-plugin-vue-template-inspector/webpack')

module.exports = {
  plugins: [
    new VueLoaderPlugin(),
    new HtmlWebpackPlugin(),
    new VueTemplateInspectorWebpackPlugin({
      enable: true,
      start: 'trae',
    }),
  ],
}

没有 html-webpack-plugin 时面板脚本插不进页面。乾坤通过 import-html-entry 拉子应用 HTML 时,仍会执行这段脚本。

选项

| 选项 | 默认 | 说明 | | --- | --- | --- | | enable | true | 为 false 时完全关闭插件 | | start | 自动检测 | 传给 launch-editor 的编辑器。可用 code、trae、webstorm 等命令名;Windows 上若命令找不到,可改成 exe 绝对路径 |

本地调试

pnpm install
pnpm dev          # Vite playground,http://localhost:5175
pnpm dev:webpack  # Webpack playground,http://localhost:5176

打开 playground 后,按住 Alt 点击页面上的元素即可验证注入、复制路径和打开编辑器。