wxt-dev / wxt-dev/wxt

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

Open
#1,537 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

pending-triage vite plugin
Dominant language
TypeScript
Stars
10.5k
Forks
564
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the reproduced wxt.config.ts and the Vite plugin configuration in https://github.com/njzzzz/wtx-code-inspector-plugin; run pnpm install and pnpm dev to capture the reported error. Trace how WXT 0.19.29 handles the configured plugins, then verify that the development run succeeds with code-inspector-plugin enabled and the background exclusion preserved.

Written by the indexing model from the issue text.

Assessment

Tech stack
tailwindcss, typescript, vite
Domain
build-system, devtools
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.