Skip to content

Upgrade VitePress to use Vite v6 #4494

Open
@simensol

Description

Is your feature request related to a problem? Please describe.

I recently upgraded my project to use Vite v6. However, I encountered type conflicts between VitePress and my project due to VitePress using Vite v5. The error message is as follows:

Type 'import("/code/node_modules/vite/dist/node/index").PluginOption' is not assignable to type 'import("/code/node_modules/vitepress/node_modules/vite/dist/node/index").PluginOption'.
  Type 'Plugin<any>' is not assignable to type 'PluginOption'.
    Type 'import("/code/node_modules/vite/dist/node/index").Plugin<any>' is not assignable to type 'import("/code/node_modules/vitepress/node_modules/vite/dist/node/index").Plugin<any>'.
      Types of property 'apply' are incompatible.
        Type '"serve" | "build" | ((this: void, config: import("/code/node_modules/vite/dist/node/index").UserConfig, env: import("/code/node_modules/vite/dist/node/index").ConfigEnv) => boolean) | undefined' is not assignable to type '"serve" | "build" | ((this: void, config: import("/code/node_modules/vitepress/node_modules/vite/dist/node/index").UserConfig, env: import("/code/node_modules/vitepress/node_modules/vite/dist/node/index").ConfigEnv) => boolean) | undefined'.
          Type '(this: void, config: UserConfig, env: ConfigEnv) => boolean' is not assignable to type '"serve" | "build" | ((this: void, config: UserConfig, env: ConfigEnv) => boolean) | undefined'.
            Type '(this: void, config: import("/code/node_modules/vite/dist/node/index").UserConfig, env: import("/code/node_modules/vite/dist/node/index").ConfigEnv) => boolean' is not assignable to type '(this: void, config: import("/code/node_modules/vitepress/node_modules/vite/dist/node/index").UserConfig, env: import("/code/node_modules/vitepress/node_modules/vite/dist/node/index").ConfigEnv) => boolean'.
              Types of parameters 'config' and 'config' are incompatible.
                Type 'import("/code/node_modules/vitepress/node_modules/vite/dist/node/index").UserConfig' is not assignable to type 'import("/code/node_modules/vite/dist/node/index").UserConfig'.
                  Types of property 'plugins' are incompatible.
                    Type 'import("/code/node_modules/vitepress/node_modules/vite/dist/node/index").PluginOption[] | undefined' is not assignable to type 'import("/code/node_modules/vite/dist/node/index").PluginOption[] | undefined'.
                      Type 'import("/code/node_modules/vitepress/node_modules/vite/dist/node/index").PluginOption[]' is not assignable to type 'import("/code/node_modules/vite/dist/node/index").PluginOption[]'.
                        Type 'import("/code/node_modules/vitepress/node_modules/vite/dist/node/index").PluginOption' is not assignable to type 'import("/code/node_modules/vite/dist/node/index").PluginOption'.
                          Type 'Plugin<any>' is not assignable to type 'PluginOption'.
                            Type 'import("/code/node_modules/vitepress/node_modules/vite/dist/node/index").Plugin<any>' is not assignable to type 'import("/code/node_modules/vite/dist/node/index").Plugin<any>'.
                              Types of property 'apply' are incompatible.
                                Type '"serve" | "build" | ((this: void, config: import("/code/node_modules/vitepress/node_modules/vite/dist/node/index").UserConfig, env: import("/code/node_modules/vitepress/node_modules/vite/dist/node/index").ConfigEnv) => boolean) | undefined' is not assignable to type '"serve" | "build" | ((this: void, config: import("/code/node_modules/vite/dist/node/index").UserConfig, env: import("/code/node_modules/vite/dist/node/index").ConfigEnv) => boolean) | undefined'.
                                  Type '(this: void, config: UserConfig, env: ConfigEnv) => boolean' is not assignable to type '"serve" | "build" | ((this: void, config: UserConfig, env: ConfigEnv) => boolean)

Describe the solution you'd like

To resolve this, could you please upgrade VitePress to use Vite v6? This will help avoid type conflicts and ensure compatibility with projects using the latest version of Vite.

Describe alternatives you've considered

No response

Additional context

The plugins causing this issue are vite-plugin-vue-devtools and vite-plugin-vuetify. These plugins are used in the Vite configuration within VitePress:

export default defineConfig({
    ...
    vite: {
        ...
        plugins: [
            vueDevTools(),
            vuetify({
                autoImport: true,
                styles: { configFile: "../../src/styles/settings.scss" }
            })
        ],
    ...
})

Validations

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