Big impact on compilation time and the chunk size with the pro packages
See original GitHub issueImporting only one icon from the pro packages, results in a 1MB plus in the bundles and 10 minutes additional compiling time.
Here is a minimal code to reproduce the issue :
`import { NgModule } from ‘@angular/core’; import { FontAwesomeModule } from ‘@fortawesome/angular-fontawesome’; import { library } from ‘@fortawesome/fontawesome-svg-core’;
import { faCircleNotch } from ‘@fortawesome/pro-regular-svg-icons’; library.add(faCircleNotch);
@NgModule({ imports: [FontAwesomeModule] }) export class IconModule {} `
Import this module in the app.module.ts
.
I have the same behavior with smaller impact with the free packages, probably because it has less icons.
Here is a reproduction repo : https://github.com/ibenjelloun/angular-fortawesome-issue34-reprodution
after the clone just update the .yarnrc with the fontawesome registry or replace pro by free in the icon.module.ts.
run yarn
+ yarn bundle-report
Issue Analytics
- State:
- Created 5 years ago
- Reactions:3
- Comments:30 (9 by maintainers)
I’ve updated my project using the steps specified in the
UPGRADING.md
file and while it does seem to work, the production build time for angular usingng build --prod
has has gone up immensely. I haven’t timed it, but I think it hangs at the step92% chunk asset optimization UglifyJSPlugin
for at least a few minutes. After which the vendor chunk is up to 7.5MB.Using deep links ea:
instead of
Does seem to fix the package size issue and make the build time acceptable, but obviously this isn’t exactly a pretty solution 😃
Looks like Webpack will be released this week with
terser
instead ofuglify-es
, which should include the fix for this. In the meantime, another potential work around (foryarn
projects) is suggested here.