windsonR / vite-plugin-virtual-html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Upgrade to vite 5

tnrich opened this issue · comments

Hey there @windsonR ,

Thanks for the great extension! I was wondering if you could update this package to be compatible with vite v5? Currently it is throwing a lint error (not a particularly helpful one).

const a = defineConfig({
  plugins: [vitePluginVirtualHtml({
    pages: {
      index: {
        entry: "./demo/index.js", // MUST
        title: `${name} demo`, // optional, default: ''
        body: `
< div id = "app" > <div id="demo" > </div></ >
` // optional, default: '<div id="app"></div>'
      }
    }
  })
  ])]
})

Error:

No overload matches this call.
  The last overload gave the following error.
    Type 'Plugin_2' is not assignable to type 'PluginOption'.
      Type 'Plugin_2' is not assignable to type 'Plugin<any>'.
        Types of property 'apply' are incompatible.
          Type '"serve" | "build" | ((this: void, config: import("/Users/tnrich/Sites/tg-oss/node_modules/vitest/node_modules/vite/dist/node/index").UserConfig, env: import("/Users/tnrich/Sites/tg-oss/node_modules/vitest/node_modules/vite/dist/node/index").ConfigEnv) => boolean) | undefined' is not assignable to type '"serve" | "build" | ((this: void, config: import("/Users/tnrich/Sites/tg-oss/node_modules/vite/dist/node/index").UserConfig, env: import("/Users/tnrich/Sites/tg-oss/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("/Users/tnrich/Sites/tg-oss/node_modules/vitest/node_modules/vite/dist/node/index").UserConfig, env: import("/Users/tnrich/Sites/tg-oss/node_modules/vitest/node_modules/vite/dist/node/index").ConfigEnv) => boolean' is not assignable to type '(this: void, config: import("/Users/tnrich/Sites/tg-oss/node_modules/vite/dist/node/index").UserConfig, env: import("/Users/tnrich/Sites/tg-oss/node_modules/vite/dist/node/index").ConfigEnv) => boolean'.
                Types of parameters 'config' and 'config' are incompatible.
                  Type 'import("/Users/tnrich/Sites/tg-oss/node_modules/vite/dist/node/index").UserConfig' is not assignable to type 'import("/Users/tnrich/Sites/tg-oss/node_modules/vitest/node_modules/vite/dist/node/index").UserConfig'.
                    Types of property 'plugins' are incompatible.
                      Type 'import("/Users/tnrich/Sites/tg-oss/node_modules/vite/dist/node/index").PluginOption[] | undefined' is not assignable to type 'import("/Users/tnrich/Sites/tg-oss/node_modules/vitest/node_modules/vite/dist/node/index").PluginOption[] | undefined'.
                        Type 'import("/Users/tnrich/Sites/tg-oss/node_modules/vite/dist/node/index").PluginOption[]' is not assignable to type 'import("/Users/tnrich/Sites/tg-oss/node_modules/vitest/node_modules/vite/dist/node/index").PluginOption[]'.
                          Type 'import("/Users/tnrich/Sites/tg-oss/node_modules/vite/dist/node/index").PluginOption' is not assignable to type 'import("/Users/tnrich/Sites/tg-oss/node_modules/vitest/node_modules/vite/dist/node/index").PluginOption'.
                            Type 'Plugin<any>' is not assignable to type 'PluginOption'.
                              Type 'Plugin<any>' is not assignable to type 'Plugin_2'.
                                Types of property 'apply' are incompatible.
                                  Type '"serve" | "build" | ((this: void, config: import("/Users/tnrich/Sites/tg-oss/node_modules/vite/dist/node/index").UserConfig, env: import("/Users/tnrich/Sites/tg-oss/node_modules/vite/dist/node/index").ConfigEnv) => boolean) | undefined' is not assignable to type '"serve" | "build" | ((this: void, config: import("/Users/tnrich/Sites/tg-oss/node_modules/vitest/node_modules/vite/dist/node/index").UserConfig, env: import("/Users/tnrich/Sites/tg-oss/node_modules/vitest/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("/Users/tnrich/Sites/tg-oss/node_modules/vite/dist/node/index").UserConfig, env: import("/Users/tnrich/Sites/tg-oss/node_modules/vite/dist/node/index").ConfigEnv) => boolean' is not assignable to type '(this: void, config: import("/Users/tnrich/Sites/tg-oss/node_modules/vitest/node_modules/vite/dist/node/index").UserConfig, env: import("/Users/tnrich/Sites/tg-oss/node_modules/vitest/node_modules/vite/dist/node/index").ConfigEnv) => boolean'.
                                        Types of parameters 'config' and 'config' are incompatible.
                                          Type 'import("/Users/tnrich/Sites/tg-oss/node_modules/vitest/node_modules/vite/dist/node/index").UserConfig' is not assignable to type 'import("/Users/tnrich/Sites/tg-oss/node_modules/vite/dist/node/index").UserConfig'.
                                            Types of property 'plugins' are incompatible.
                                              Type 'import("/Users/tnrich/Sites/tg-oss/node_modules/vitest/node_modules/vite/dist/node/index").PluginOption[] | undefined' is not assignable to type 'import("/Users/tnrich/Sites/tg-oss/node_modules/vite/dist/node/index").PluginOption[] | undefined'.
                                                Type 'import("/Users/tnrich/Sites/tg-oss/node_modules/vitest/node_modules/vite/dist/node/index").PluginOption[]' is not assignable to type 'import("/Users/tnrich/Sites/tg-oss/node_modules/vite/dist/node/index").PluginOption[]'.
                                                  Type 'import("/Users/tnrich/Sites/tg-oss/node_modules/vitest/node_modules/vite/dist/node/index").PluginOption' is not assignable to type 'import("/Users/tnrich/Sites/tg-oss/node_modules/vite/dist/node/index").PluginOption'.
                                                    Type 'PluginOption[]' is not assignable to type 'PluginOption'.

Thank you!

Please update to 1.1.17, I test in my project, It looks like has no type error.

Ehhhh, I close a wrone issue...

It has been a long time since there was a response, so this ISSUE is now closed.