kreuzerk / svg-to-ts

Build performant SVG icon libraries by converting raw SVG files to TypeScript that is optimized for modern tree shaking mechanisms.
MIT License
272 stars 44 forks source link

Threeshaking not working #227

Closed meijer3 closed 11 months ago

meijer3 commented 11 months ago

My problem is that all icons are included in my anuglar 16 project. I assume that is due to the barrel loadfile, like https://github.com/kreuzerk/svg-to-ts/issues/158. Our lib sits inside a package @my/icons import {myIconSun} from '@my/icons' (this is whats vscode thinks is best).

But with webpackage analyzer I see that all 2000 icons are in the angular build.

kreuzerk commented 11 months ago

Hi @meijer3 thanks a lot for this issue. It depends on the setup of your library. It's hard to say what it could be. But if you have properly setup an Icon library and some sort of registry (which is all independent of svg-to-ts) it should work. From svg-to-ts points its important that you use the svg-to-ts-files conversion mode. If all this doesn't work then my first guess is that the sideEffects flag is not properly set inside your library.