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

How to realize singleton sharing of service exposed by third party package in mf #23209

Closed
1 of 4 tasks
EnochGao opened this issue May 7, 2024 · 8 comments
Closed
1 of 4 tasks
Assignees
Labels
outdated scope: module federation Issues related to module federation support type: bug

Comments

@EnochGao
Copy link

EnochGao commented May 7, 2024

Current Behavior

In mf, the service of the host application cannot be obtained from the service child application exposed by the third-party package

Expected Behavior

want to share

GitHub Repo

https://github.com/EnochGao/nx-test

Steps to Reproduce

There are some third-party library packages to export a global service, here I use "my-base": "file:dist/libs/my-base", simulation, the sub-application is no value

Nx Report

none

Failure Logs

No response

Package Manager Version

No response

Operating System

  • macOS
  • Linux
  • Windows
  • Other (Please specify)

Additional Information

No response

@EnochGao
Copy link
Author

EnochGao commented May 7, 2024

nx version 17.0.3 works fine

@EnochGao
Copy link
Author

EnochGao commented May 7, 2024

Didn't solve this problem #21036

@Coly010 Coly010 added the scope: module federation Issues related to module federation support label May 7, 2024
@Coly010 Coly010 self-assigned this May 7, 2024
@Coly010
Copy link
Contributor

Coly010 commented May 7, 2024

After further investigation, this is being caused by using "my-base": "file:dist/libs/my-base",
There may be an issue in our project graph creation where it is not considering file: protocol correctly.

@EnochGao
Copy link
Author

EnochGao commented May 8, 2024

You can compile a service and drop it into node_module with the same effect

@EnochGao
Copy link
Author

For example, NzIconServiceNzConfigService in ng-antd-zorro,will export service in root,but in mf sub applicaction ,unable to get the service instance of host

@Sir-J
Copy link

Sir-J commented Jul 11, 2024

For example, NzIconServiceNzConfigService in ng-antd-zorro,will export service in root,but in mf sub applicaction ,unable to get the service instance of host

nx + mf + ng-zorro not work in 17 and 18 version (I'm open issue). Version 16 work fine

@Coly010
Copy link
Contributor

Coly010 commented Jul 26, 2024

Closing in favour of: #26878

@Coly010 Coly010 closed this as completed Jul 26, 2024
Copy link

This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 26, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated scope: module federation Issues related to module federation support type: bug
Projects
None yet
Development

No branches or pull requests

3 participants