Skip to content

Runtime Plugin - beforePreloadRemote #2505

@RussellCanfield

Description

@RussellCanfield

Describe the bug

It appears that types are not working correctly for beforePreloadRemote in a runtime plugin. When implementing the hook in a plugin like so:

@module-federation/enhanced v0.1.13
import type { FederationRuntimePlugin } from '@module-federation/enhanced/runtime';

const runtimePlugin: () => FederationRuntimePlugin = function () {
  return {
    name: 'my-runtime-plugin',
    async beforePreloadRemote(args) {
      //args here is of type any
      console.log(args);
      return args;
    },
  };
};
export default runtimePlugin;

It appears that "args" being passed into "beforePreloadRemote" is any. The object names are also not correct, intelisense picks them up as "preloadOps" but it is actually "preloadOptions".

Reproduction

https://github.com/RussellCanfield/nx-rspack-microfrontend-demo/blob/47616c706e7cdd996cf55a45d8655679d977033a/apps/mfe-monorepo/src/dynamic-loader-plugin.ts#L7

Used Package Manager

npm

System Info

@module-federation/enhanced v0.1.13
VSCode
Typescript 5.4.4

Validations

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions