storyblok / field-plugin

Create and deploy Storyblok Field Plugin
https://www.storyblok.com/docs/plugins/field-plugins/introduction
MIT License
25 stars 3 forks source link

Vite 5 support ? #389

Open marckraw opened 5 months ago

marckraw commented 5 months ago

Just tried to update to Vite 5, to be on the newest version, and having this errors, is the plugins support Vite 5 and i'm doping something wrong, or it's not supported yet ? :) sending also my vite.config.ts (but its basically boilerplate one)

import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import cssInjectedByJs from 'vite-plugin-css-injected-by-js'
import { plugins } from '@storyblok/field-plugin/vite'

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [react(), cssInjectedByJs(), ...plugins],
  build: {
    rollupOptions: {
      output: {
        format: 'commonjs',
        entryFileNames: `[name].js`,
        chunkFileNames: `[name].js`,
        assetFileNames: `[name].[ext]`,
      },
    },
  },
  server: {
    port: 8080,
    host: true,
  },
})
@ef-global/backpack-sb-plugins-common:lint: vite.config.ts:8:22 - error TS2769: No overload matches this call.
@ef-global/backpack-sb-plugins-common:lint:   The last overload gave the following error.
@ef-global/backpack-sb-plugins-common:lint:     Type 'Plugin<any>[]' is not assignable to type 'PluginOption'.
@ef-global/backpack-sb-plugins-common:lint:       Type 'Plugin<any>[]' is not assignable to type 'PluginOption[]'.
@ef-global/backpack-sb-plugins-common:lint:         Type 'Plugin<any>' is not assignable to type 'PluginOption'.
@ef-global/backpack-sb-plugins-common:lint:           Type 'Plugin<any>' is not assignable to type 'Plugin_2'.
@ef-global/backpack-sb-plugins-common:lint:             Types of property 'apply' are incompatible.
@ef-global/backpack-sb-plugins-common:lint:               Type '"serve" | "build" | ((this: void, config: import("/Users/marckraw/Projects/EF/gc/backpack-sb-plugins-react/node_modules/vite/dist/node/index").UserConfig, env: import("/Users/marckraw/Projects/EF/gc/backpack-sb-plugins-react/node_modules/vite/dist/node/index").ConfigEnv) => boolean) | undefined' is not assignable to type '"serve" | "build" | ((this: void, config: import("/Users/marckraw/Projects/EF/gc/backpack-sb-plugins-react/packages/common/node_modules/vite/dist/node/index").UserConfig, env: import("/Users/marckraw/Projects/EF/gc/backpack-sb-plugins-react/packages/common/node_modules/vite/dist/node/index").ConfigEnv) => boolean) |...'.
@ef-global/backpack-sb-plugins-common:lint:                 Type '(this: void, config: UserConfig, env: ConfigEnv) => boolean' is not assignable to type '"serve" | "build" | ((this: void, config: UserConfig, env: ConfigEnv) => boolean) | undefined'.
@ef-global/backpack-sb-plugins-common:lint:                   Type '(this: void, config: import("/Users/marckraw/Projects/EF/gc/backpack-sb-plugins-react/node_modules/vite/dist/node/index").UserConfig, env: import("/Users/marckraw/Projects/EF/gc/backpack-sb-plugins-react/node_modules/vite/dist/node/index").ConfigEnv) => boolean' is not assignable to type '(this: void, config: import("/Users/marckraw/Projects/EF/gc/backpack-sb-plugins-react/packages/common/node_modules/vite/dist/node/index").UserConfig, env: import("/Users/marckraw/Projects/EF/gc/backpack-sb-plugins-react/packages/common/node_modules/vite/dist/node/index").ConfigEnv) => boolean'.
@ef-global/backpack-sb-plugins-common:lint:                     Types of parameters 'config' and 'config' are incompatible.
@ef-global/backpack-sb-plugins-common:lint:                       Type 'import("/Users/marckraw/Projects/EF/gc/backpack-sb-plugins-react/packages/common/node_modules/vite/dist/node/index").UserConfig' is not assignable to type 'import("/Users/marckraw/Projects/EF/gc/backpack-sb-plugins-react/node_modules/vite/dist/node/index").UserConfig'.
@ef-global/backpack-sb-plugins-common:lint:                         Types of property 'plugins' are incompatible.
@ef-global/backpack-sb-plugins-common:lint:                           Type 'import("/Users/marckraw/Projects/EF/gc/backpack-sb-plugins-react/packages/common/node_modules/vite/dist/node/index").PluginOption[] | undefined' is not assignable to type 'import("/Users/marckraw/Projects/EF/gc/backpack-sb-plugins-react/node_modules/vite/dist/node/index").PluginOption[] | undefined'.
@ef-global/backpack-sb-plugins-common:lint:                             Type 'import("/Users/marckraw/Projects/EF/gc/backpack-sb-plugins-react/packages/common/node_modules/vite/dist/node/index").PluginOption[]' is not assignable to type 'import("/Users/marckraw/Projects/EF/gc/backpack-sb-plugins-react/node_modules/vite/dist/node/index").PluginOption[]'.
@ef-global/backpack-sb-plugins-common:lint:                               Type 'import("/Users/marckraw/Projects/EF/gc/backpack-sb-plugins-react/packages/common/node_modules/vite/dist/node/index").PluginOption' is not assignable to type 'import("/Users/marckraw/Projects/EF/gc/backpack-sb-plugins-react/node_modules/vite/dist/node/index").PluginOption'.
@ef-global/backpack-sb-plugins-common:lint:                                 Type 'Plugin_2' is not assignable to type 'PluginOption'.
@ef-global/backpack-sb-plugins-common:lint:                                   Type 'Plugin_2' is not assignable to type 'Plugin<any>'.
@ef-global/backpack-sb-plugins-common:lint:                                     Types of property 'apply' are incompatible.
@ef-global/backpack-sb-plugins-common:lint:                                       Type '"serve" | "build" | ((this: void, config: import("/Users/marckraw/Projects/EF/gc/backpack-sb-plugins-react/packages/common/node_modules/vite/dist/node/index").UserConfig, env: import("/Users/marckraw/Projects/EF/gc/backpack-sb-plugins-react/packages/common/node_modules/vite/dist/node/index").ConfigEnv) => boolean) |...' is not assignable to type '"serve" | "build" | ((this: void, config: import("/Users/marckraw/Projects/EF/gc/backpack-sb-plugins-react/node_modules/vite/dist/node/index").UserConfig, env: import("/Users/marckraw/Projects/EF/gc/backpack-sb-plugins-react/node_modules/vite/dist/node/index").ConfigEnv) => boolean) | undefined'.
@ef-global/backpack-sb-plugins-common:lint:                                         Type '(this: void, config: UserConfig, env: ConfigEnv) => boolean' is not assignable to type '"serve" | "build" | ((this: void, config: UserConfig, env: ConfigEnv) => boolean) | undefined'.
@ef-global/backpack-sb-plugins-common:lint:                                           Type '(this: void, config: import("/Users/marckraw/Projects/EF/gc/backpack-sb-plugins-react/packages/common/node_modules/vite/dist/node/index").UserConfig, env: import("/Users/marckraw/Projects/EF/gc/backpack-sb-plugins-react/packages/common/node_modules/vite/dist/node/index").ConfigEnv) => boolean' is not assignable to type '(this: void, config: import("/Users/marckraw/Projects/EF/gc/backpack-sb-plugins-react/node_modules/vite/dist/node/index").UserConfig, env: import("/Users/marckraw/Projects/EF/gc/backpack-sb-plugins-react/node_modules/vite/dist/node/index").ConfigEnv) => boolean'.
@ef-global/backpack-sb-plugins-common:lint:                                             Types of parameters 'config' and 'config' are incompatible.
@ef-global/backpack-sb-plugins-common:lint:                                               Type 'import("/Users/marckraw/Projects/EF/gc/backpack-sb-plugins-react/node_modules/vite/dist/node/index").UserConfig' is not assignable to type 'import("/Users/marckraw/Projects/EF/gc/backpack-sb-plugins-react/packages/common/node_modules/vite/dist/node/index").UserConfig'.
@ef-global/backpack-sb-plugins-common:lint:                                                 Types of property 'plugins' are incompatible.
@ef-global/backpack-sb-plugins-common:lint:                                                   Type 'import("/Users/marckraw/Projects/EF/gc/backpack-sb-plugins-react/node_modules/vite/dist/node/index").PluginOption[] | undefined' is not assignable to type 'import("/Users/marckraw/Projects/EF/gc/backpack-sb-plugins-react/packages/common/node_modules/vite/dist/node/index").PluginOption[] | undefined'.
@ef-global/backpack-sb-plugins-common:lint:                                                     Type 'import("/Users/marckraw/Projects/EF/gc/backpack-sb-plugins-react/node_modules/vite/dist/node/index").PluginOption[]' is not assignable to type 'import("/Users/marckraw/Projects/EF/gc/backpack-sb-plugins-react/packages/common/node_modules/vite/dist/node/index").PluginOption[]'.
@ef-global/backpack-sb-plugins-common:lint:                                                       Type 'import("/Users/marckraw/Projects/EF/gc/backpack-sb-plugins-react/node_modules/vite/dist/node/index").PluginOption' is not assignable to type 'import("/Users/marckraw/Projects/EF/gc/backpack-sb-plugins-react/packages/common/node_modules/vite/dist/node/index").PluginOption'.
@ef-global/backpack-sb-plugins-common:lint:                                                         Type 'Promise<false | Plugin<any> | PluginOption[] | null | undefined>' is not assignable to type 'PluginOption'.
@ef-global/backpack-sb-plugins-common:lint:                                                           Type 'Promise<false | Plugin<any> | PluginOption[] | null | undefined>' is not assignable to type 'Promise<false | Plugin_2 | PluginOption[] | null | undefined>'.
@ef-global/backpack-sb-plugins-common:lint:                                                             Type 'false | Plugin<any> | PluginOption[] | null | undefined' is not assignable to type 'false | Plugin_2 | PluginOption[] | null | undefined'.
@ef-global/backpack-sb-plugins-common:lint:                                                               Type 'Plugin<any>' is not assignable to type 'false | Plugin_2 | PluginOption[] | null | undefined'.
@ef-global/backpack-sb-plugins-common:lint:                                                                 Type 'import("/Users/marckraw/Projects/EF/gc/backpack-sb-plugins-react/node_modules/vite/dist/node/index").PluginOption' is not assignable to type 'import("/Users/marckraw/Projects/EF/gc/backpack-sb-plugins-react/packages/common/node_modules/vite/dist/node/index").PluginOption'.
@ef-global/backpack-sb-plugins-common:lint:
@ef-global/backpack-sb-plugins-common:lint: 8   plugins: [react(), cssInjectedByJs(), ...plugins],
@ef-global/backpack-sb-plugins-common:lint:                        ~~~~~~~~~~~~~~~~~
@ef-global/backpack-sb-plugins-common:lint:
@ef-global/backpack-sb-plugins-common:lint:   node_modules/vite/dist/node/index.d.ts:579:25
@ef-global/backpack-sb-plugins-common:lint:     579 export declare function defineConfig(config: UserConfigExport): UserConfigExport;
@ef-global/backpack-sb-plugins-common:lint:                                 ~~~~~~~~~~~~
@ef-global/backpack-sb-plugins-common:lint:     The last overload is declared here.
@ef-global/backpack-sb-plugins-common:lint:
@ef-global/backpack-sb-plugins-common:lint: vite.config.ts:8:41 - error TS2769: No overload matches this call.
@ef-global/backpack-sb-plugins-common:lint:   The last overload gave the following error.
@ef-global/backpack-sb-plugins-common:lint:     Type 'Plugin<any>[]' is not assignable to type 'PluginOption'.
@ef-global/backpack-sb-plugins-common:lint:       Type 'Plugin<any>[]' is not assignable to type 'PluginOption[]'.
@ef-global/backpack-sb-plugins-common:lint:         Type 'Plugin<any>' is not assignable to type 'PluginOption'.
@ef-global/backpack-sb-plugins-common:lint:           Type 'Plugin<any>' is not assignable to type 'Plugin_2'.
@ef-global/backpack-sb-plugins-common:lint:             Types of property 'apply' are incompatible.
@ef-global/backpack-sb-plugins-common:lint:               Type '"serve" | "build" | ((this: void, config: import("/Users/marckraw/Projects/EF/gc/backpack-sb-plugins-react/node_modules/vite/dist/node/index").UserConfig, env: import("/Users/marckraw/Projects/EF/gc/backpack-sb-plugins-react/node_modules/vite/dist/node/index").ConfigEnv) => boolean) | undefined' is not assignable to type '"serve" | "build" | ((this: void, config: import("/Users/marckraw/Projects/EF/gc/backpack-sb-plugins-react/packages/common/node_modules/vite/dist/node/index").UserConfig, env: import("/Users/marckraw/Projects/EF/gc/backpack-sb-plugins-react/packages/common/node_modules/vite/dist/node/index").ConfigEnv) => boolean) |...'.
@ef-global/backpack-sb-plugins-common:lint:                 Type '(this: void, config: UserConfig, env: ConfigEnv) => boolean' is not assignable to type '"serve" | "build" | ((this: void, config: UserConfig, env: ConfigEnv) => boolean) | undefined'.
@ef-global/backpack-sb-plugins-common:lint:                   Type '(this: void, config: import("/Users/marckraw/Projects/EF/gc/backpack-sb-plugins-react/node_modules/vite/dist/node/index").UserConfig, env: import("/Users/marckraw/Projects/EF/gc/backpack-sb-plugins-react/node_modules/vite/dist/node/index").ConfigEnv) => boolean' is not assignable to type '(this: void, config: import("/Users/marckraw/Projects/EF/gc/backpack-sb-plugins-react/packages/common/node_modules/vite/dist/node/index").UserConfig, env: import("/Users/marckraw/Projects/EF/gc/backpack-sb-plugins-react/packages/common/node_modules/vite/dist/node/index").ConfigEnv) => boolean'.
@ef-global/backpack-sb-plugins-common:lint:                     Types of parameters 'config' and 'config' are incompatible.
@ef-global/backpack-sb-plugins-common:lint:                       Type 'import("/Users/marckraw/Projects/EF/gc/backpack-sb-plugins-react/packages/common/node_modules/vite/dist/node/index").UserConfig' is not assignable to type 'import("/Users/marckraw/Projects/EF/gc/backpack-sb-plugins-react/node_modules/vite/dist/node/index").UserConfig'.
@ef-global/backpack-sb-plugins-common:lint:                         Types of property 'plugins' are incompatible.
@ef-global/backpack-sb-plugins-common:lint:                           Type 'import("/Users/marckraw/Projects/EF/gc/backpack-sb-plugins-react/packages/common/node_modules/vite/dist/node/index").PluginOption[] | undefined' is not assignable to type 'import("/Users/marckraw/Projects/EF/gc/backpack-sb-plugins-react/node_modules/vite/dist/node/index").PluginOption[] | undefined'.
@ef-global/backpack-sb-plugins-common:lint:                             Type 'import("/Users/marckraw/Projects/EF/gc/backpack-sb-plugins-react/packages/common/node_modules/vite/dist/node/index").PluginOption[]' is not assignable to type 'import("/Users/marckraw/Projects/EF/gc/backpack-sb-plugins-react/node_modules/vite/dist/node/index").PluginOption[]'.
@ef-global/backpack-sb-plugins-common:lint:                               Type 'import("/Users/marckraw/Projects/EF/gc/backpack-sb-plugins-react/packages/common/node_modules/vite/dist/node/index").PluginOption' is not assignable to type 'import("/Users/marckraw/Projects/EF/gc/backpack-sb-plugins-react/node_modules/vite/dist/node/index").PluginOption'.
@ef-global/backpack-sb-plugins-common:lint:                                 Type 'Plugin_2' is not assignable to type 'PluginOption'.
@ef-global/backpack-sb-plugins-common:lint:                                   Type 'Plugin_2' is not assignable to type 'Plugin<any>'.
@ef-global/backpack-sb-plugins-common:lint:                                     Types of property 'apply' are incompatible.
@ef-global/backpack-sb-plugins-common:lint:                                       Type '"serve" | "build" | ((this: void, config: import("/Users/marckraw/Projects/EF/gc/backpack-sb-plugins-react/packages/common/node_modules/vite/dist/node/index").UserConfig, env: import("/Users/marckraw/Projects/EF/gc/backpack-sb-plugins-react/packages/common/node_modules/vite/dist/node/index").ConfigEnv) => boolean) |...' is not assignable to type '"serve" | "build" | ((this: void, config: import("/Users/marckraw/Projects/EF/gc/backpack-sb-plugins-react/node_modules/vite/dist/node/index").UserConfig, env: import("/Users/marckraw/Projects/EF/gc/backpack-sb-plugins-react/node_modules/vite/dist/node/index").ConfigEnv) => boolean) | undefined'.
@ef-global/backpack-sb-plugins-common:lint:                                         Type '(this: void, config: UserConfig, env: ConfigEnv) => boolean' is not assignable to type '"serve" | "build" | ((this: void, config: UserConfig, env: ConfigEnv) => boolean) | undefined'.
@ef-global/backpack-sb-plugins-common:lint:                                           Type '(this: void, config: import("/Users/marckraw/Projects/EF/gc/backpack-sb-plugins-react/packages/common/node_modules/vite/dist/node/index").UserConfig, env: import("/Users/marckraw/Projects/EF/gc/backpack-sb-plugins-react/packages/common/node_modules/vite/dist/node/index").ConfigEnv) => boolean' is not assignable to type '(this: void, config: import("/Users/marckraw/Projects/EF/gc/backpack-sb-plugins-react/node_modules/vite/dist/node/index").UserConfig, env: import("/Users/marckraw/Projects/EF/gc/backpack-sb-plugins-react/node_modules/vite/dist/node/index").ConfigEnv) => boolean'.
@ef-global/backpack-sb-plugins-common:lint:                                             Types of parameters 'config' and 'config' are incompatible.
@ef-global/backpack-sb-plugins-common:lint:                                               Type 'import("/Users/marckraw/Projects/EF/gc/backpack-sb-plugins-react/node_modules/vite/dist/node/index").UserConfig' is not assignable to type 'import("/Users/marckraw/Projects/EF/gc/backpack-sb-plugins-react/packages/common/node_modules/vite/dist/node/index").UserConfig'.
@ef-global/backpack-sb-plugins-common:lint:                                                 Types of property 'plugins' are incompatible.
@ef-global/backpack-sb-plugins-common:lint:                                                   Type 'import("/Users/marckraw/Projects/EF/gc/backpack-sb-plugins-react/node_modules/vite/dist/node/index").PluginOption[] | undefined' is not assignable to type 'import("/Users/marckraw/Projects/EF/gc/backpack-sb-plugins-react/packages/common/node_modules/vite/dist/node/index").PluginOption[] | undefined'.
@ef-global/backpack-sb-plugins-common:lint:                                                     Type 'import("/Users/marckraw/Projects/EF/gc/backpack-sb-plugins-react/node_modules/vite/dist/node/index").PluginOption[]' is not assignable to type 'import("/Users/marckraw/Projects/EF/gc/backpack-sb-plugins-react/packages/common/node_modules/vite/dist/node/index").PluginOption[]'.
@ef-global/backpack-sb-plugins-common:lint:                                                       Type 'import("/Users/marckraw/Projects/EF/gc/backpack-sb-plugins-react/node_modules/vite/dist/node/index").PluginOption' is not assignable to type 'import("/Users/marckraw/Projects/EF/gc/backpack-sb-plugins-react/packages/common/node_modules/vite/dist/node/index").PluginOption'.
@ef-global/backpack-sb-plugins-common:lint:                                                         Type 'Promise<false | Plugin<any> | PluginOption[] | null | undefined>' is not assignable to type 'PluginOption'.
@ef-global/backpack-sb-plugins-common:lint:                                                           Type 'Promise<false | Plugin<any> | PluginOption[] | null | undefined>' is not assignable to type 'Promise<false | Plugin_2 | PluginOption[] | null | undefined>'.
@ef-global/backpack-sb-plugins-common:lint:                                                             Type 'false | Plugin<any> | PluginOption[] | null | undefined' is not assignable to type 'false | Plugin_2 | PluginOption[] | null | undefined'.
@ef-global/backpack-sb-plugins-common:lint:                                                               Type 'Plugin<any>' is not assignable to type 'false | Plugin_2 | PluginOption[] | null | undefined'.
@ef-global/backpack-sb-plugins-common:lint:                                                                 Type 'import("/Users/marckraw/Projects/EF/gc/backpack-sb-plugins-react/node_modules/vite/dist/node/index").PluginOption' is not assignable to type 'import("/Users/marckraw/Projects/EF/gc/backpack-sb-plugins-react/packages/common/node_modules/vite/dist/node/index").PluginOption'.
@ef-global/backpack-sb-plugins-common:lint:
@ef-global/backpack-sb-plugins-common:lint: 8   plugins: [react(), cssInjectedByJs(), ...plugins],
@ef-global/backpack-sb-plugins-common:lint:                                           ~~~~~~~~~~
@ef-global/backpack-sb-plugins-common:lint:
@ef-global/backpack-sb-plugins-common:lint:   node_modules/vite/dist/node/index.d.ts:579:25
@ef-global/backpack-sb-plugins-common:lint:     579 export declare function defineConfig(config: UserConfigExport): UserConfigExport;
@ef-global/backpack-sb-plugins-common:lint:                                 ~~~~~~~~~~~~
@ef-global/backpack-sb-plugins-common:lint:     The last overload is declared here.
@ef-global/backpack-sb-plugins-common:lint:
@ef-global/backpack-sb-plugins-common:lint: vitest.config.ts:5:3 - error TS2345: Argument of type 'UserConfig & Promise<UserConfig> & (UserConfigFnObject & UserConfigExport)' is not assignable to parameter of type 'never'.
@ef-global/backpack-sb-plugins-common:lint:   Type 'UserConfig & Promise<UserConfig> & UserConfigFnObject' is not assignable to type 'never'.
@ef-global/backpack-sb-plugins-common:lint:
@ef-global/backpack-sb-plugins-common:lint: 5   viteConfig,
@ef-global/backpack-sb-plugins-common:lint:     ~~~~~~~~~~
@ef-global/backpack-sb-plugins-common:lint:
@ef-global/backpack-sb-plugins-common:lint:
@ef-global/backpack-sb-plugins-common:lint: Found 3 errors in 2 files.
@ef-global/backpack-sb-plugins-common:lint:
@ef-global/backpack-sb-plugins-common:lint: Errors  Files
@ef-global/backpack-sb-plugins-common:lint:      2  vite.config.ts:8
@ef-global/backpack-sb-plugins-common:lint:      1  vitest.config.ts:5
eunjae-lee commented 1 month ago

Hi @marckraw sorry for the late reply. There's a type issue there, and I haven't really found out the cause yet, because to me the type seems correct. You may want to just ignore the warning for the moment.