nx icon indicating copy to clipboard operation
nx copied to clipboard

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

Open EnochGao opened this issue 1 year ago • 2 comments
trafficstars

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
  • [X] Linux
  • [ ] Windows
  • [ ] Other (Please specify)

Additional Information

No response

EnochGao avatar May 07 '24 01:05 EnochGao

nx version 17.0.3 works fine

EnochGao avatar May 07 '24 01:05 EnochGao

Didn't solve this problem #21036

EnochGao avatar May 07 '24 01:05 EnochGao

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.

Coly010 avatar May 07 '24 11:05 Coly010

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

EnochGao avatar May 08 '24 01:05 EnochGao

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

EnochGao avatar May 10 '24 02:05 EnochGao

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

Sir-J avatar Jul 11 '24 09:07 Sir-J

Closing in favour of: https://github.com/nrwl/nx/issues/26878

Coly010 avatar Jul 26 '24 15:07 Coly010

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[bot] avatar Aug 26 '24 00:08 github-actions[bot]