-
Notifications
You must be signed in to change notification settings - Fork 209
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
Unable to resolve specifier 'date-fns/format' Angular 18 #705
Comments
Hi, do you use the latest version of NF? |
We're having the same issue with the lib chart.js. I think it's the same problem: both packages use the CommonJS export format and don't seem to have any ESM support. |
Hello @manfredsteyer , I think I have found the issue regarding both packages: secondary entrypoint in the packages being imported from a third-party lib. Both packages, beside the main module, exposes multiple submodules for ease of use, for instance : The workaround is to duplicate the sharing of the lib (one for the main module via the NF plugin and another for the problematic(s) submodule(s) manually).
I don't know if that is enough for you or if you will want to add some logic to the NF plugin to take these secondary entrypoints into account... @vahidsamimi, the offending piece of code is not in the service that you posted but in a function from the date-fns-tz package that your using in your codebase. The function (most likely culprit is formatInTimeZone, look around for the imports from date-fns-tz) is importing the format function from date-fns via the secondary entrypoint (in my case it was the PrimeNG chart component that imports charts.js/auto). Hope this helps |
I'd love to investigate this a bit more but I really need a simple reproduction in the form of a github project. |
I added the following two packages as dependencies in the
package.json
fileHowever, when I run the remote app that uses these packages, I encounter the error
Below is the code where I define the
DateHelperService
, which I import into the remote app.and here is federation.config.js
The text was updated successfully, but these errors were encountered: