Skip to content

Font Awesome 5 webpack bundle size on latest release #126

@LH221

Description

@LH221

By default the main chunk size for production is:

main.js 1.12 MiB 0 [emitted] [big] main

This seemes to be caused by using the require function to import the icons:

library.add(
require('@fortawesome/free-solid-svg-icons').faEnvelope,
...
)

still imports the entirety of @fortawesome/free-solid-svg-icons in the chunk it seems.

Just changing the code to the following (as documented by vue-fontawesome) results in a dramatic reduction:

import { faEnvelope, faHeart, faGraduationCap, faHome, faInfo, faList, faSpinner } from '@fortawesome/free-solid-svg-icons'
import { faFontAwesome, faMicrosoft, faVuejs } from '@fortawesome/free-brands-svg-icons'
library.add(faEnvelope, faHeart, faGraduationCap, faHome, faInfo, faList, faSpinner, faFontAwesome, faMicrosoft, faVuejs)

main.js 81.5 KiB 0 [emitted] main

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions