Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vite Plugin Error: Error occurs during dev run when configuring the code-inspector-plugin. #1537

Open
5 tasks done
njzzzz opened this issue Mar 27, 2025 · 0 comments
Open
5 tasks done
Labels
pending-triage Someone (usually a maintainer) needs to look into this to see if it's a bug

Comments

@njzzzz
Copy link

njzzzz commented Mar 27, 2025

Describe the bug

Error occurs during dev run when configuring the code-inspector-plugin.

Image

wxt.config.ts

import { resolve } from 'node:path'
import tailwindcss from '@tailwindcss/vite'
import { codeInspectorPlugin } from 'code-inspector-plugin'
import { defineConfig } from 'wxt'
// See https://wxt.dev/api/config.html
export default defineConfig({
  extensionApi: 'chrome',
  modules: ['@wxt-dev/module-react'],
  manifest: {
    name: 'Prime copilot',
    icons: {
      16: '/logo.png',
      48: '/logo.png',
      128: '/logo.png',
    },
    permissions: [
      // 'sidePanel',
      'scripting',
      'tabs',
      'activeTab',
      'storage',
    ],
    host_permissions: ['<all_urls>'],
    // side_panel: {
    //   default_path: 'sidepanel/index.html',
    // },
    action: {
      default_title: '点击打开侧边栏',
    },
  },
  vite() {
    return {
      plugins: [
        tailwindcss() as any,
        codeInspectorPlugin({
          bundler: 'vite',
          exclude: /background/,
        }),
      ],
      resolve: {
        // 插件的资源都要打包进去
        alias: [
          {
            find: /@prime\/copilot-utils/,
            replacement: resolve(__dirname, '../copilot-utils/index.ts'),
          },
          {
            find: /@sidepanel/,
            replacement: resolve(__dirname, './entrypoints/sidepanel'),
          },
        ],
      },
    }
  },
})

Reproduction

https://github.com/njzzzz/wtx-code-inspector-plugin

Steps to reproduce

pnpm install
pnpm dev

System Info

System:
    OS: macOS 15.3.2
    CPU: (8) arm64 Apple M1 Pro
    Memory: 98.19 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.18.1 - ~/.nvm/versions/node/v20.18.1/bin/node
    Yarn: 1.22.22 - ~/.nvm/versions/node/v20.18.1/bin/yarn
    npm: 10.8.2 - ~/.nvm/versions/node/v20.18.1/bin/npm
    pnpm: 9.15.2 - ~/.nvm/versions/node/v20.18.1/bin/pnpm
  Browsers:
    Chrome: 134.0.6998.166
    Safari: 18.3.1
  npmPackages:
    wxt: ^0.19.29 => 0.19.29

Used Package Manager

pnpm

Validations

@njzzzz njzzzz added the pending-triage Someone (usually a maintainer) needs to look into this to see if it's a bug label Mar 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pending-triage Someone (usually a maintainer) needs to look into this to see if it's a bug
Projects
None yet
Development

No branches or pull requests

1 participant