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

feat: add getModule and getContainer to utilities #476

Merged

Conversation

schirrel
Copy link
Contributor

As state at the discussion #399

if (!modFactory) return undefined;
const mod = modFactory();
if (exportName) {
return mod && typeof mod === 'object' ? mod[exportName] : undefined;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use optional chaining and nullish coalescing?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ExProbitasFiducia in fact i only had isolate the source code and bring to the utilities, i haven't develop the code 😅

@ScriptedAlchemy using optional chaining and nullish coalescing here would have the same effect or you had avoided to use because you've found any problem?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See if it compiles down to ES5 or not, if it keeps the modern syntax then id avoid using it since it will break some browsers / node versions

Copy link

@NyanHelsing NyanHelsing Jan 12, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It *should* according to this SO post, but it could be down to config; it depends what the target we're compiling to is. If we're targeting es5 in our config then it ought to work though; full disclosure I have not checked that nor have I looked at the config.

https://stackoverflow.com/questions/64201477/does-the-nullish-coalescing-operator-in-typescript-have-more-browser-suppor

@ScriptedAlchemy
Copy link
Member

Lint fail in CI

@schirrel
Copy link
Contributor Author

@ScriptedAlchemy i merge and fix conflicts and run nx lint now 🙏🏻

@ScriptedAlchemy ScriptedAlchemy merged commit fe381e3 into module-federation:main Jan 30, 2023
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

Successfully merging this pull request may close these issues.

3 participants