nivekcode / svg-to-ts

Build performant SVG icon libraries by converting raw SVG files to TypeScript that is optimized for modern tree shaking mechanisms.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Threeshaking not working

meijer3 opened this issue · comments

commented

My problem is that all icons are included in my anuglar 16 project.
I assume that is due to the barrel loadfile, like #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.

commented

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.