ngneat / svg-icon

👻 A lightweight library that makes it easier to use SVG icons in your Angular Application
https://netbasal.com
MIT License
260 stars 35 forks source link

fix: allow referring to SVG_ICONS_CONFIG before being defined #118

Closed tspmelo closed 1 year ago

tspmelo commented 1 year ago

Close #114

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

[x] Bugfix
[ ] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[ ] CI related changes
[ ] Documentation content changes
[ ] Other... Please describe:

What is the current behavior?

Issue Number: #114

What is the new behavior?

SVG_ICONS_CONFIG injection doesn't fail while it's still not defined and Jest is able to run successfully.

Does this PR introduce a breaking change?

[ ] Yes
[x] No

Other information

stackblitz[bot] commented 1 year ago

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

NetanelBasal commented 1 year ago

I'm not sure what issue you're fixing. Can you explain, please?

tspmelo commented 1 year ago

Like I mention on the issue, currently the fesm2015 version is causing failure in jest. I try finding a similar issue in @angular/cli but could not find anything, so I decided it should be easier to handle it here. While trying to debug the issue locally, and given that the error happens because the code is trying to inject before the config is provided, I tried to use fowardRef on that inject and it started to work. Since this doesn't break anything I decided to open the PR with it.