ngneat / svg-icon

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

SVG Icons are generated successfully in serve mode but not in prod mode #141

Closed BenLune closed 10 months ago

BenLune commented 11 months ago

I'm submitting a...


[ ] Regression (a behavior that used to work and stopped working in a new release)
[x ] Bug report  
[ ] Performance issue
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request
[ ] Other... Please describe:

Current behavior

When I serve my app, the icons are generated with no problem. But when I bouild prod, the svg ts files are not generated so my app doesn't compile.

Expected behavior

Svg ts generation files on build prod

Minimal reproduction of the problem with instructions

What is the motivation / use case for changing the behavior?

Environment

"nx": "16.10.0", "@angular/core": "16.2.8", "@ngneat/svg-icon": "^7.1.0"

Browser:

For Tooling issues:

BenLune commented 11 months ago

My icons are in a lib. Maybe the webpack config is called when building the app. So maybe my lib is built without the svg generator script.

BenLune commented 11 months ago

Ok, that's the reason why it didn't work... I spent hours to understand why it didn't work. Instead of relying on a custom webpack config, I run the svg-generator script before building my lib and my app. I use the "svgGenerator" defined in package.json. It works well, but it would be great to be able to define several svgGenerator objects. In a mono repo we have several apps, which would need different icons sets. I hope it will help someone.

BenLune commented 11 months ago

it runs locally, but it fails on Gitlab CI : $ svg-generator /bin/sh: 1: svg-generator: not found

BenLune commented 11 months ago

It works now, I don't know exactly why.