Skip to content

ESBuild plugin dts warning. #42

@tmg0

Description

@tmg0

Describe the bug

Description

When I import unplugin-vue-jsx/esbuild in the vscode editor, the esbuild plugin displays a type error.

So I have to use the plugin like:

import { defineConfig } from 'tsup'
import VueJSX from 'unplugin-vue-jsx'

export default defineConfig(options => ({
  entry: ['src/index.ts'],
  esbuildPlugins: [VueJSX.esbuild({})]
}))

Noticed that the version of esbuild is declared in the package.json file of unplugin-vue-jsx. When using import * as esbuild from 'esbuild', it prefers this version, which seems to be the cause of the problem.

I'm not very clear if it's possible to remove the specified version of esbuild from the dependencies. Is there any special consideration for declaring it here? I build the project locally, and it seems to be fine after removal.

I created a new repository on StackBlitz, but it seems that the hints are different from those in my local editor, so I've included a screenshot.

截屏2024-03-19 16 25 52

Logs

Argument of type '(options: Options) => { entry: string[]; splitting: true; clean: true; treeshake: true; dts: true; format: ("cjs" | "esm")[]; minify: boolean; esbuildPlugins: Plugin[]; }' is not assignable to parameter of type 'Options | Options[] | ((overrideOptions: Options) => MaybePromise<Options | Options[]>)'.
  Type '(options: Options) => { entry: string[]; splitting: true; clean: true; treeshake: true; dts: true; format: ("cjs" | "esm")[]; minify: boolean; esbuildPlugins: Plugin[]; }' is not assignable to type '(overrideOptions: Options) => MaybePromise<Options | Options[]>'.

Reproduction

https://stackblitz.com/edit/stackblitz-starters-7or5g1

System Info

System:
    OS: macOS 14.2
    CPU: (8) arm64 Apple M2
    Memory: 67.39 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 18.19.1 - ~/.volta/tools/image/node/18.19.1/bin/node
    npm: 10.2.4 - ~/.volta/tools/image/node/18.19.1/bin/npm
    pnpm: 8.15.4 - ~/.volta/tools/image/pnpm/8.15.4/bin/pnpm
  Browsers:
    Chrome: 122.0.6261.129
    Safari: 17.2

Used Package Manager

pnpm

Validations

  • Follow our Code of Conduct
  • Read the Contributing Guide.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • Check that this is a concrete bug. For Q&A, please open a GitHub Discussion instead.
  • The provided reproduction is a minimal reproducible of the bug.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions