How to prevent font from being build on Angular 2+

Viewed 104

In my css, I imported a css library, this library decided to include a huge font-faces. Now my service worker download a huge payload for nothing.

I want to excluded the font files from my build and service worker configuration, any suggestion?

I Already tried "exclude" on Angular.json and tsconfig.json.

1 Answers

I'm having a similar issue. A few projects and libraries are in a single repo and they all use some common fonts which are pretty big (~30Mb). All these apps are then packed in a single zip file. The zip file grew from ~60Mb to ~240Mb because all these fonts are built in every app.

The only solution I could find was to create a script that extracts all these fonts from each app, put them in a common folder in dist, and configure the backend to serve all the font files from this new folder. The script is running after the build step.

Related