Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Align package configuration api #2427

Closed
2 tasks done
ulrichgreen opened this issue Apr 30, 2024 · 3 comments
Closed
2 tasks done

Align package configuration api #2427

ulrichgreen opened this issue Apr 30, 2024 · 3 comments

Comments

@ulrichgreen
Copy link

Clear and concise description of the problem

This is a minor one :) ... My OCD goes a little bit off when I have to do this when configuring all your wonderful packages (typescript setup):

import { ModuleFederationPlugin } from '@module-federation/enhanced';
import { FederatedTypesPlugin } from '@module-federation/typescript';
import { NativeFederationTestsRemote } from '@module-federation/native-federation-tests';

const moduleFederationConfig = {// config here}

new ModuleFederationPlugin(moduleFederationConfig),
new FederatedTypesPlugin({ federationConfig: moduleFederationConfig }),
NativeFederationTestsRemote.webpack({ moduleFederationConfig }),

Suggested solution

I would love to have the interfaces aligned and be able to do:

import { ModuleFederationPlugin } from '@module-federation/enhanced';
import { FederatedTypesPlugin } from '@module-federation/typescript';
import { NativeFederationTestsRemote } from '@module-federation/native-federation-tests/webpack';

const moduleFederationConfig = {// config here}

new ModuleFederationPlugin({ moduleFederationConfig }),
new FederatedTypesPlugin({ moduleFederationConfig }),
new NativeFederationTestsRemote({ moduleFederationConfig }),

This will, in my eyes, make it a bit more streamlined to use for us consumers.

And just to spell it out :) some plugins expect a key like "federationConfig", while others expect "moduleFederationConfig". Some requires instantiation (new Plugin() vs Plugin()). The exact naming is not so important, as log as its aligned.

Alternative

No response

Additional context

No response

Validations

  • Read the Contributing Guidelines.
  • Check that there isn't already an issue that request the same feature to avoid creating a duplicate.
@ScriptedAlchemy
Copy link
Member

Federated Types can be replaced with just module federation enhanced, since it comes with built in type system already.

@ilteoood
Copy link
Collaborator

ilteoood commented May 1, 2024

If you want to avoid to use NativeFederationTests.webpack, you should import the native-federation-tests/webpack module.

You'll still be unable to use "new" keyword due to the structure of the plugin.

@ulrichgreen
Copy link
Author

Closing, as my OCD is satisfied with the built in type system :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants