JSPM

  • Created
  • Published
  • Downloads 687468
  • Score
    100M100P100Q192295F
  • License MIT

jump to local IDE source code while click the element of browser automatically.

Package Exports

  • vite-plugin-vue-inspector

Readme

vite-plugin-vue-inspector

NPM Version NPM Downloads License

๐Ÿ“– Introduction

A vite plugin which provides the ability that to jump to the local IDE when you click the element of browser automatically. It supports Vue2 & 3.

vite-plugin-vue-inspector

๐Ÿ“ฆ Installation

# pnpm 
pnpm install vite-plugin-vue-inspector -D

# yarn
yarn add vite-plugin-vue-inspector -D

# npm
npm install vite-plugin-vue-inspector -D

๐Ÿฆ„ Usage

Configuration Vite

// for vue2

import { defineConfig } from "vite"
import { createVuePlugin } from "vite-plugin-vue2"
import Inspector from "vite-plugin-vue-inspector"

export default defineConfig({
  plugins: [
    createVuePlugin(),
    Inspector({
      vue: 2,
    }),
  ],
})
// for vue3

import { defineConfig } from "vite"
import Vue from "@vitejs/plugin-vue"
import Inspector from "vite-plugin-vue-inspector"

export default defineConfig({
  plugins: [Vue(), Inspector()],
})

Example

๐Ÿ”Œ Configuration IDE / Editor

It uses an environment variable named VUE_EDITOR to specify an IDE application, but if you do not set this variable, it will try to open a common IDE that you have open or installed once it is certified.

For example, if you want it always open VSCode when inspection clicked, set export VUE_EDITOR=code in your shell.

VSCode

  • install VSCode command line tools, see the official docs install-vscode-cli

  • set env to shell, like .bashrc or .zshrc

    export VUE_EDITOR=code

WebStorm

  • just set env with an absolute path to shell, like .bashrc or .zshrc (only MacOS)

    export VUE_EDITOR='/Applications/WebStorm.app/Contents/MacOS/webstorm'

OR

  • install WebStorm command line tools

  • then set env to shell, like .bashrc or .zshrc

    export VUE_EDITOR=webstorm

Vim

Yes! you can also use vim if you want, just set env to shell

export VUE_EDITOR=vim

๐Ÿ’ก Notice

  • It only work in develop mode .
  • It does not currently support SSR and Template Engine (e.g. pug) .

๐ŸŒธ Thanks

This project is inspired by react-dev-inspector .

๐Ÿค–๏ธ Analysis of Theory

[Chinese] ็‚นๅ‡ป้กต้ขๅ…ƒ็ด ,่ฟ™ไธชViteๆ’ไปถๅธฎๆˆ‘ๆ‰“ๅผ€ไบ†Vue็ป„ไปถ

๐Ÿ“„ License

MIT LICENSE