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 🙏

© 2024 – Pkg Stats / Ryan Hefner

vnode-plugin

v1.0.2

Published

用于向 vue 项目编译后的 dom 上注入其对应编译前的代码在编辑器中位置信息的 webpack loader。<br/>

Downloads

1

Readme

vnode-plugin

用于向 vue 项目编译后的 dom 上注入其对应编译前的代码在编辑器中位置信息的 webpack loader。

配合 vnode-loader 一起使用

安装

1. 安装 vnode-loadervnode-plugin

在项目根目录执行以下命令:

yarn add vnode-loader vnode-plugin -D

or

npm install vnode-loader vnode-plugin -D

2. 修改 vue.config.js 文件

vue.config.js 文件中,添加如下的 chainWebpack 配置(注意需要判定一下环境,该功能只用于开发环境下)

// vue.config.js
module.exports = {
  // ...other code
  chainWebpack: (config) => {
    // 添加如下代码,注意判别环境
    if (process.env.NODE_ENV === 'development') {
      const VNodePlugin = require('vnode-plugin');
      config.module
        .rule('vue')
        .test(/\.vue$/)
        .use('vnode-loader')
        .loader('vnode-loader')
        .end();
      config.plugin('vnode-plugin').use(new VNodePlugin());
    }
  },
};

3. 添加环境配置

  • 在项目根目录添加一个名为 .env.local 的文件夹,内容如下:

    # editor
    VUE_EDITOR=code
  • 在 vscode 中执行 Command + Shift + P, 输入 shell Command: Install 'code' command in Path 并点击该命令:

    出现以下弹窗表示设置成功:

使用及效果

如下图所示,点击页面中 V 的悬浮窗,变成绿色时代表功能开启。(再次点击可置灰关闭功能) 鼠标移动至页面元素上会出现其信息,点击即可唤起 vscode 并跳转至其对应代码位置。

性能

经多个大中型项目测试,对打 build 及 rebuild 的性能影响可忽略不计,可放心食用。