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

Support for vite@6 async plugins #7014

Open
6 tasks done
manuel3108 opened this issue Dec 3, 2024 · 2 comments
Open
6 tasks done

Support for vite@6 async plugins #7014

manuel3108 opened this issue Dec 3, 2024 · 2 comments

Comments

@manuel3108
Copy link

Describe the bug

Using @sveltejs/[email protected] and [email protected] makes tsc fail with the following vite.config.ts

import { defineConfig } from 'vitest/config';
import { sveltekit } from '@sveltejs/kit/vite';

export default defineConfig({
    plugins: [sveltekit()],
});

Problem was first reported in sveltejs/cli#341. While a user is adding vitest to his project, we are switching out the imports inside vite.config.ts like this:

// without vitest
import { defineConfig } from 'vite';

// with vitest
import { defineConfig } from "vitest/config";

This is likely caused by vite@6 allowing plugins of type Promise<whatever>. Looks like this change was not backported to config used by vitest

Reproduction

https://stackblitz.com/edit/node-zjetgl?file=vite.config.ts

Wait for npm i to complete. Run npm run check. The issue will appear. IntelliSense also complains

System Info

System:
    OS: Linux 5.0 undefined
    CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 0 Bytes / 0 Bytes
    Shell: 1.0 - /bin/jsh
  Binaries:
    Node: 18.20.3 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 10.2.3 - /usr/local/bin/npm
    pnpm: 8.15.6 - /usr/local/bin/pnpm
  npmPackages:
    vite: ^6.0.0 => 6.0.2 
    vitest: ^2.1.8 => 2.1.8

Used Package Manager

npm

Validations

@manuel3108
Copy link
Author

I was just made aware of that this was reverted as part of https://github.com/vitest-dev/vitest/releases/tag/v2.1.7, but i would still keep this issue open, as i was unable to find any other issue that's referencing vite 6 support.

But please feel free to close.

@niemyjski
Copy link

2.1.7 broke npm run check for us:

import { sveltekit } from '@sveltejs/kit/vite';
import Icons from 'unplugin-icons/vite';
import { defineConfig } from 'vitest/config';

const aspNetConfig = getAspNetConfig();

export default defineConfig({
    build: {
        sourcemap: true,
        target: 'esnext'
    },
    plugins: [
        sveltekit(),
        Icons({
            compiler: 'svelte'
        })
    ],
Exceptionless\src\Exceptionless.Web\ClientApp\vite.config.ts:14:9
Error: No overload matches this call.
  The last overload gave the following error.
    Type 'Promise<Plugin<any>[]>' is not assignable to type 'PluginOption'.
      Type 'Promise<Plugin<any>[]>' is not assignable to type 'Promise<false | Plugin<any> | PluginOption[] | null | undefined>'.
        Type 'Plugin<any>[]' is not assignable to type 'false | Plugin<any> | PluginOption[] | null | undefined'.
          Type 'Plugin<any>[]' is not assignable to type 'PluginOption[]'.
            Type 'Plugin<any>' is not assignable to type 'PluginOption'.

niemyjski added a commit to exceptionless/Exceptionless that referenced this issue Dec 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants