0.0.6 • Published 3 years ago
@jarunwang/vite-vscode-link v0.0.6
通过 shift+左键点击页面元素,快速在 vscode 中定位代码位置 Vite

引入
    // 引入只需如下三步
    //1、install package
    yarn add @jarunwang/vue-code-link --dev
    //2、vite.config.js
    import { openCodeServer, addCodeLocation } from '@jarunwang/vue-code-link';
    export default ({ command, mode }: ConfigEnv): UserConfig => {
        ...
        const isBuild = command === 'build';
        const codePlugins = !isBuild ? [openCodeServer(), addCodeLocation()] : [];
        return {
            base: VITE_PUBLIC_PATH,
            root,
            resolve: {
            alias: [
                {
                    find: 'vue-i18n',
                    replacement: 'vue-i18n/dist/vue-i18n.cjs.js'
                },
                ...
            ],
            ...
            plugins:[...codePlugins,...]
            ...
        }
    }
    //3、main.js
    import { openCodeClient } from '@jarunwang/vue-code-link'
    openCodeClient.init()编辑器命令加入环境变量 vscode
- 使用 command + shift + p (注意 window 下使用 ctrl + shift + p ) 然后搜索 code,选择 install 'code' command in path。