vite icon indicating copy to clipboard operation
vite copied to clipboard

[Bug]: Support Vite v7 Plugin Type

Open islam-kamel opened this issue 6 months ago • 3 comments

Describe the bug

Latest version of Vite v7 Accept Plugin only as PluginOption Type

Version

v7

Reproduction

install [email protected], Apply Federation Configuration using defineConfig function with typescript

Relevant log output

TS2769: No overload matches this call.
The last overload gave the following error.
Argument of type
({ mode }: ConfigEnv) => {
  server: {
    port: number;
  };
  base: string;
  plugins: (PluginOption[] | Plugin<any>[])[];
}
is not assignable to parameter of type UserConfigExport
Type
({ mode }: ConfigEnv) => {
  server: {
    port: number;
  };
  base: string;
  plugins: (PluginOption[] | Plugin<any>[])[];
}
is not assignable to type UserConfigFnObject
Call signature return types
{
  server: {
    port: number;
  };
  base: string;
  plugins: (PluginOption[] | Plugin<any>[])[];
}
and UserConfig are incompatible.
The types of plugins are incompatible between these types.
Type (PluginOption[] | Plugin<any>[])[] is not assignable to type PluginOption[]
Type PluginOption[] | Plugin<any>[] is not assignable to type PluginOption
Type Plugin<any>[] is not assignable to type PluginOption
Type Plugin<any>[] is not assignable to type PluginOption[]
Type Plugin<any> is not assignable to type PluginOption
Type Plugin<any> is not assignable to type Plugin$1<any>
Types of property hotUpdate are incompatible.
Type 'ObjectHook<(this: HotUpdatePluginContext, options: HotUpdateOptions) => void | EnvironmentModuleNode[] | Promise<void | EnvironmentModuleNode[]>> | undefined' is not assignable to type 'ObjectHook<(this: MinimalPluginContext & { environment: DevEnvironment; }, options: HotUpdateOptions) => void | EnvironmentModuleNode[] | Promise<...>> | undefined'.
Type
(this: HotUpdatePluginContext, options: HotUpdateOptions) => void | EnvironmentModuleNode[] | Promise<void | EnvironmentModuleNode[]>
is not assignable to type
ObjectHook<(this: MinimalPluginContext & {
  environment: DevEnvironment;
}, options: HotUpdateOptions) => void | EnvironmentModuleNode[] | Promise<...>> | undefined
Type
(this: HotUpdatePluginContext, options: HotUpdateOptions) => void | EnvironmentModuleNode[] | Promise<void | EnvironmentModuleNode[]>
is not assignable to type
(this: MinimalPluginContext & {
  environment: DevEnvironment;
}, options: HotUpdateOptions) => void | EnvironmentModuleNode[] | Promise<...>
Types of parameters options and options are incompatible.
Property 'environment' is missing in type 'import("projects/node_modules/.pnpm/[email protected]_@[email protected]/node_modules/vite/dist/node/index").HotUpdateOptions' but required in type 'import("/node_modules/.pnpm/[email protected]_@[email protected]/node_modules/vite/dist/node/index").HotUpdateOptions'.

Validations

islam-kamel avatar Jul 04 '25 13:07 islam-kamel

This could be a bit of a pain point for new Module Federation adoptees

dmg-egg avatar Jul 20 '25 19:07 dmg-egg

ooh yes, I think the main reason may be a defect in the configuration of package

islam-kamel avatar Jul 21 '25 06:07 islam-kamel

As there's been no activity for 30 days, this issue has been flagged as stale. If you'd like it to remain open, please add a comment within the next 7 days. Thank you.

github-actions[bot] avatar Oct 29 '25 14:10 github-actions[bot]