Skip to content

Insanely Huge Bundle Sizes on Next.JS #6

Closed

Description

@dukesx

Hello,

Love the work you guys are doing, i have been looking for this for a long time. Now just a little problem here, i am trying to use react based component so that i can utilize it in my Nextjs project but it seems that there is no tree shaking in it at all. I used 5 icons , and the project ended me with a bundle size of 1.5mb Gzipped with icons (React Components) , without icons, 238kb. Please check.

Activity

  1. maltejur commented on Sep 26, 2021

    @maltejur
    Collaborator

    This issue has to do with how webpack imports the packages. You probably import the icons something like this:

    import { ReactOriginalIcon } from "react-devicons";

    This will import the whole react-devicons package including all icons into your browser bundle, regardless of how many icons you actually use. To fix this, import the icon like this:

    import ReactOriginalIcon from "react-devicons/react/original";

    This will only import the ReactOriginalIcon.

  2. pinned this issue on Sep 26, 2021
  3. dukesx commented on Sep 27, 2021

    @dukesx
    Author

    Thank you

  4. added a commit that references this issue on Nov 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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