Skip to content

Node types are pulled accidentally by importing vite types #1459

Description

@minht11

Describe the bug

See the same issue in different package Anber/wyw-in-js#33

I was investigating why node types are included in my project and came to cause being .wxt/types/imports.d.ts file, which imports for example:
const ContentScriptContext: typeof import('wxt/client')['ContentScriptContext']

And that file uses:

import { ContentScriptDefinition } from '../../types'

Which in turn imports:
import type * as vite from 'vite';

If we look at vite, it uses <reference types="node" /> which means any file importing it also gets the same types.

Image

The fix would be split vite types from client ones, so two are not mixed.

Reproduction

n/a

Steps to reproduce

Try using const timeout: number = setTimeout(() => {})

System Info

"wxt": "^0.19.27"

Used Package Manager

pnpm

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions