Skip to content

WxtVitest type error when updating to 0.20.7 #1702

Description

@mengxi-ream

Describe the bug

import react from '@vitejs/plugin-react'
// vitest.config.ts
import { defineConfig } from 'vitest/config'

import { WxtVitest } from 'wxt/testing'

export default defineConfig({
  plugins: [WxtVitest(), react()],
  test: {
    environment: 'node',
    globals: true,
    setupFiles: 'vitest.setup.ts',
    watch: false,
    coverage: {
      provider: 'istanbul',
      reporter: ['text', 'html', 'lcov'],
    },
  },
})

After upgrading from 0.20.6 to 0.20.7, I met the error:

> read-frog@0.9.0 compile /Users/leonz/Github/read-frog
> tsc --noEmit

vitest.config.ts:8:13 - error TS2769: No overload matches this call.
  The last overload gave the following error.
    Type 'Promise<PluginOption[]>' is not assignable to type 'PluginOption'.
      Type 'Promise<PluginOption[]>' is not assignable to type 'Promise<Plugin<any> | FalsyPlugin | PluginOption[]>'.
        Type 'PluginOption[]' is not assignable to type 'Plugin<any> | FalsyPlugin | PluginOption[]'.
          Type 'import("/Users/leonz/Github/read-frog/node_modules/.pnpm/vite@6.3.5_@types+node@22.14.1_jiti@2.4.2_lightningcss@1.29.2_yaml@2.7.1/node_modules/vite/dist/node/index").PluginOption[]' is not assignable to type 'import("/Users/leonz/Github/read-frog/node_modules/.pnpm/vite@6.3.0_@types+node@22.14.1_jiti@2.4.2_lightningcss@1.29.2_yaml@2.7.1/node_modules/vite/dist/node/index").PluginOption[]'.
            Type 'import("/Users/leonz/Github/read-frog/node_modules/.pnpm/vite@6.3.5_@types+node@22.14.1_jiti@2.4.2_lightningcss@1.29.2_yaml@2.7.1/node_modules/vite/dist/node/index").PluginOption' is not assignable to type 'import("/Users/leonz/Github/read-frog/node_modules/.pnpm/vite@6.3.0_@types+node@22.14.1_jiti@2.4.2_lightningcss@1.29.2_yaml@2.7.1/node_modules/vite/dist/node/index").PluginOption'.
              Type 'Plugin<any>' is not assignable to type 'PluginOption'.
                Type 'import("/Users/leonz/Github/read-frog/node_modules/.pnpm/vite@6.3.5_@types+node@22.14.1_jiti@2.4.2_lightningcss@1.29.2_yaml@2.7.1/node_modules/vite/dist/node/index").Plugin<any>' is not assignable to type 'import("/Users/leonz/Github/read-frog/node_modules/.pnpm/vite@6.3.0_@types+node@22.14.1_jiti@2.4.2_lightningcss@1.29.2_yaml@2.7.1/node_modules/vite/dist/node/index").Plugin<any>'.
                  Types of property 'hotUpdate' are incompatible.
                    Type 'import("/Users/leonz/Github/read-frog/node_modules/.pnpm/rollup@4.40.0/node_modules/rollup/dist/rollup").ObjectHook<(this: HotUpdatePluginContext, options: import("/Users/leonz/Github/read-frog/node_modules/.pnpm/vite@6.3.5_@types+node@22.14.1_jiti@2.4.2_lightningcss@1.29.2_yaml@2.7.1/node_modules/vite/dist/node/ind...' is not assignable to type 'import("/Users/leonz/Github/read-frog/node_modules/.pnpm/rollup@4.40.0/node_modules/rollup/dist/rollup").ObjectHook<(this: HotUpdatePluginContext, options: import("/Users/leonz/Github/read-frog/node_modules/.pnpm/vite@6.3.0_@types+node@22.14.1_jiti@2.4.2_lightningcss@1.29.2_yaml@2.7.1/node_modules/vite/dist/node/ind...'.
                      Type '(this: HotUpdatePluginContext, options: HotUpdateOptions) => void | EnvironmentModuleNode[] | Promise<void | EnvironmentModuleNode[]>' is not assignable to type 'ObjectHook<(this: HotUpdatePluginContext, options: HotUpdateOptions) => void | EnvironmentModuleNode[] | Promise<void | EnvironmentModuleNode[]>> | undefined'.
                        Type '(this: HotUpdatePluginContext, options: import("/Users/leonz/Github/read-frog/node_modules/.pnpm/vite@6.3.5_@types+node@22.14.1_jiti@2.4.2_lightningcss@1.29.2_yaml@2.7.1/node_modules/vite/dist/node/index").HotUpdateOptions) => void | ... 1 more ... | Promise<...>' is not assignable to type '(this: HotUpdatePluginContext, options: import("/Users/leonz/Github/read-frog/node_modules/.pnpm/vite@6.3.0_@types+node@22.14.1_jiti@2.4.2_lightningcss@1.29.2_yaml@2.7.1/node_modules/vite/dist/node/index").HotUpdateOptions) => void | ... 1 more ... | Promise<...>'.
                          The 'this' types of each signature are incompatible.
                            Type 'HotUpdatePluginContext' is not assignable to type 'HotUpdatePluginContext'. Two different types with this name exist, but they are unrelated.
                              The types of 'environment.pluginContainer.environment' are incompatible between these types.
                                Type 'import("/Users/leonz/Github/read-frog/node_modules/.pnpm/vite@6.3.0_@types+node@22.14.1_jiti@2.4.2_lightningcss@1.29.2_yaml@2.7.1/node_modules/vite/dist/node/index").Environment' is not assignable to type 'import("/Users/leonz/Github/read-frog/node_modules/.pnpm/vite@6.3.5_@types+node@22.14.1_jiti@2.4.2_lightningcss@1.29.2_yaml@2.7.1/node_modules/vite/dist/node/index").Environment'.
                                  Type 'DevEnvironment' is not assignable to type 'Environment'.

8   plugins: [WxtVitest(), react()],
              ~~~~~~~~~~~

  node_modules/.pnpm/vitest@3.1.3_@types+debug@4.1.12_@types+node@22.14.1_jiti@2.4.2_jsdom@26.1.0_lightningcss@1.29.2_yaml@2.7.1/node_modules/vitest/dist/config.d.ts:88:18
    88 declare function defineConfig(config: UserConfigExport): UserConfigExport;
                        ~~~~~~~~~~~~
    The last overload is declared here.


Found 1 error in vitest.config.ts:8

Reproduction

https://github.com/mengxi-ream/read-frog

Steps to reproduce

  1. clone https://github.com/mengxi-ream/read-frog
  2. upgrade wxt to 0.20.7
  3. run pnpm compile (which is tsc --noEmit

System Info

System:
    OS: macOS 15.2
    CPU: (8) arm64 Apple M1 Pro
    Memory: 133.17 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 22.14.0 - ~/.nvm/versions/node/v22.14.0/bin/node
    npm: 10.9.2 - ~/.nvm/versions/node/v22.14.0/bin/npm
    pnpm: 10.10.0 - ~/.nvm/versions/node/v22.14.0/bin/pnpm
  Browsers:
    Chrome: 137.0.7151.56
    Safari: 18.2
  npmPackages:
    wxt: ^0.20.7 => 0.20.7

Used Package Manager

pnpm

Validations

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    pending-triageSomeone (usually a maintainer) needs to look into this to see if it's a bug

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions