@code-inspector/turbopack

中文文档
2.0.9发布于 2026/09/12MITTypeScriptESM + CJS近 30 天下载 132万

Click the dom on the page, it will open your IDE and position the cursor to the source code location of the dom.

原始使用文档
文档目录9 节
  1. code-inspector
  2. 📖 Introduction
  3. 💻 Try it out online
  4. 🎨 Support
  5. 🚀 Install
  6. 🌈 Usage
  7. 👨‍💻 Contributors
  8. 📧 Communication and Feedback
  9. 💖 Sponsor

code-inspector

中文文档 | Documentation

NPM version GITHUB star NPM Downloads MIT-license GITHUB-language


📖 Introduction

Click the element on the page, it can automatically open the code editor and position the cursor to the source code of the element.

code-inspector

💻 Try it out online

🎨 Support

The following are which compilers, web frameworks and editors we supported now:

  • The following bundlers are currently supported:
    ✅ webpack
    ✅ vite
    ✅ rspack / rsbuild
    ✅ farm
    ✅ esbuild
    ✅ turbopack
    ✅ mako
  • The following Web frameworks are currently supported:
    ✅ vue2 / vue3 / nuxt
    ✅ react / nextjs / umijs
    ✅ preact
    ✅ solid
    ✅ qwik
    ✅ svelte
    ✅ astro
  • Supported editor list | and Others

🚀 Install

npm i code-inspector-plugin -D
# or
yarn add code-inspector-plugin -D
# or
pnpm add code-inspector-plugin -D

🌈 Usage

Please check here for more usage information: code-inspector-plugin configuration

  • 1.Configuring Build Tools

    Click to expand configuration about: webpack
    // webpack.config.js
    const { codeInspectorPlugin } = require('code-inspector-plugin');
    
    module.exports = () => ({
      plugins: [
        codeInspectorPlugin({
          bundler: 'webpack',
        }),
      ],
    });
    
    Click to expand configuration about: vite
    // vite.config.js
    import { defineConfig } from 'vite';
    import { codeInspectorPlugin } from 'code-inspector-plugin';
    
    export default defineConfig({
      plugins: [
        codeInspectorPlugin({
          bundler: 'vite',
        }),
      ],
    });
    
    Click to expand configuration about: rspack
    // rspack.config.js
    const { codeInspectorPlugin } = require('code-inspector-plugin');
    
    module.exports = {
      // other config...
      plugins: [
        codeInspectorPlugin({
          bundler: 'rspack',
        }),
        // other plugins...
      ],
    };
    
    Click to expand configuration about: rsbuild
    // rsbuild.config.js
    const { codeInspectorPlugin } = require('code-inspector-plugin');
    
    module.exports = {
      // other config...
      tools: {
        rspack: {
          plugins: [
            codeInspectorPlugin({
              bundler: 'rspack',
            }),
          ],
        },
      },
    };
    
    Click to expand configuration about: esbuild
    // esbuild.config.js
    const esbuild = require('esbuild');
    const { codeInspectorPlugin } = require('code-inspector-plugin');
    
    esbuild.build({
      // other configs...
      // [注意] esbuild 中使用时,dev 函数的返回值需自己根据环境判断,本地开发的环境返回 true,线上打包返回 false
      plugins: [codeInspectorPlugin({ bundler: 'esbuild', dev: () => true })],
    });
    
    Click to expand configuration about: farm
    // farm.config.js
    import { defineConfig } from '@farmfe/core';
    import { codeInspectorPlugin } from 'code-inspector-plugin';
    
    export default defineConfig({
      vitePlugins: [
        codeInspectorPlugin({
          bundler: 'vite',
        }),
        // ...other code
      ],
    });
    
    Click to expand configuration about: vue-cli
    // vue.config.js
    const { codeInspectorPlugin } = require('code-inspector-plugin');
    
    module.exports = {
      // ...other code
      chainWebpack: (config) => {
        config.plugin('code-inspector-plugin').use(
          codeInspectorPlugin({
            bundler: 'webpack',
          })
        );
      },
    };
    
    Click to expand configuration about: nuxt
    • For nuxt3.x :

      // nuxt.config.js
      import { codeInspectorPlugin } from 'code-inspector-plugin';
      
      // https://nuxt.com/docs/api/configuration/nuxt-config
      export default defineNuxtConfig({
        vite: {
          plugins: [codeInspectorPlugin({ bundler: 'vite' })],
        },
      });
      
    • For nuxt2.x :

      // nuxt.config.js
      import { codeInspectorPlugin } from 'code-inspector-plugin';
      
      export default {
        build: {
          extend(config) {
            config.plugins.push(codeInspectorPlugin({ bundler: 'webpack' }));
            return config;
          },
        },
      };
      
    Click to expand configuration about: next.js
    • For next.js(<= 14.x):

      // next.config.js
      const { codeInspectorPlugin } = require('code-inspector-plugin');
      
      const nextConfig = {
        webpack: (config, { dev, isServer }) => {
          config.plugins.push(codeInspectorPlugin({ bundler: 'webpack' }));
          return config;
        },
      };
      
      module.exports = nextConfig;
      
    • For next.js(15.0.x ~ 15.2.x):

      import type { NextConfig } from 'next';
      import { codeInspectorPlugin } from 'code-inspector-plugin';
      
      const nextConfig: NextConfig = {
        experimental: {
          turbo: {
            rules: codeInspectorPlugin({
              bundler: 'turbopack',
            }),
          },
        },
      };
      
      export default nextConfig;
      
    • For next.js(>= 15.3.x):

      // next.config.js
      import type { NextConfig } from 'next';
      import { codeInspectorPlugin } from 'code-inspector-plugin';
      
      const nextConfig: NextConfig = {
        turbopack: {
          rules: codeInspectorPlugin({
            bundler: 'turbopack',
          }),
        },
      };
      
      export default nextConfig;
      
    Click to expand configuration about: umi.js
    • With webpack:

      // umi.config.js or umirc.js
      import { defineConfig } from '@umijs/max';
      import { codeInspectorPlugin } from 'code-inspector-plugin';
      
      export default defineConfig({
        chainWebpack(memo) {
          memo.plugin('code-inspector-plugin').use(
            codeInspectorPlugin({
              bundler: 'webpack',
            })
          );
        },
        // other config
      });
      
    • With mako:

      // .umirc.ts
      import { defineConfig } from 'umi';
      import { codeInspectorPlugin } from 'code-inspector-plugin';
      
      export default defineConfig({
        // other config...
        mako: {
          plugins: [
            codeInspectorPlugin({
              bundler: 'mako',
            }),
          ],
        },
      });
      
    Click to expand configuration about: astro
    // astro.config.mjs
    import { defineConfig } from 'astro/config';
    import { codeInspectorPlugin } from 'code-inspector-plugin';
    
    export default defineConfig({
      vite: {
        plugins: [codeInspectorPlugin({ bundler: 'vite' })],
      },
    });
    
  • 2.Using the function

    Now you can enjoy using it!~

    When pressing the combination keys on the page, moving the mouse over the page will display a mask layer on the DOM with relevant information. Clicking will automatically open the IDE and position the cursor to the corresponding code location. (The default combination keys for Mac are Option + Shift; for Windows, it's Alt + Shift, and the browser console will output related combination key prompts)

👨‍💻 Contributors

Special thanks to the contributors of this project:

📧 Communication and Feedback

For any usage issues, please leave a message below my Twitter post or submit an issue on Github.

For Chinese users, you can join the QQ group 769748484 or add the author's WeiXin account zhoulx1688888 for consultation and feedback:

💖 Sponsor

Sponsoring this project can help the author create better. If you are willing, you can sponsor me through Alipay or WeChatPay:

版本与发布记录

@code-inspector/turbopack 共发布 63 个版本,首次发布于 2025/08/13;过去 12 个月发布了 46 个版本。

版本发布日期距今
2.0.9latest2026/09/121 个月前
2.0.82026/08/242 个月前
2.0.72026/07/313 个月前
2.0.62026/07/283 个月前
2.0.52026/07/243 个月前
2.0.42026/07/203 个月前

其他发布通道:beta → 2.0.0-beta.9。

关于 @code-inspector/turbopack 的常见问题

@code-inspector/turbopack 是什么?

Click the dom on the page, it will open your IDE and position the cursor to the source code location of the dom.

如何安装 @code-inspector/turbopack?

在项目目录运行 npm install @code-inspector/turbopack,或使用 pnpm add / yarn add / bun add。

@code-inspector/turbopack 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@code-inspector/turbopack 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@code-inspector/turbopack 可以商用吗?

@code-inspector/turbopack 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@code-inspector/turbopack 的下载量有多少?

根据 npm 官方下载统计,@code-inspector/turbopack 在 2026/10/10 – 2026/11/08 这 30 天内被下载 1,319,855 次,日均约 43,995 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@code-inspector/turbopack 还在维护吗?

最新版本 2.0.9 发布于 2026/09/12(1 个月前);至今共发布 63 个版本,其中过去 12 个月发布了 46 个;首次发布于 2025/08/13。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。