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

Open
1 of 4 tasks
EnochGao opened this issue May 7, 2024 · 5 comments
Open
1 of 4 tasks
Assignees
Labels
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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
scope: module federation Issues related to module federation support type: bug
Projects
None yet
Development

No branches or pull requests

2 participants