Giter Site home page Giter Site logo

bundle size about react HOT 7 CLOSED

nativanando avatar nativanando commented on April 19, 2024
bundle size

from react.

Comments (7)

JoTrdl avatar JoTrdl commented on April 19, 2024 7

I confirm, still happening in 1.4.1

from react.

nativanando avatar nativanando commented on April 19, 2024 1

Thanks for the explanation, I was using destructuring imports and the bundle was still big.. But, Happily the problem was in the lib version I was using (1.0.0) I've just updated to 1.2.1 and, great news, problem solved!! 😄

from react.

rektdeckard avatar rektdeckard commented on April 19, 2024

The react library fully supports tree-shaking, so it likely comes down to your bundler configuration or the way you're importing the icons. In apps bootstrapped with create-react-app, or when using most modern bundlers, simply using destructuring imports should work fine:

import { Smiley, Rainbow } from "phosphor-react";

Screenshot from 2021-05-24 23-28-51

Using the default import, import Phosphor from "phosphor-react"; or importing everything import * as Icons from "phosphor-react"; may or may not import the entire contents of the library, so try not to do that.

Screenshot from 2021-05-24 23-28-27

If you need to, you can import icons directly from the bundled source:

import Smiley from "phosphor-react/dist/icons/Smiley.esm.js";

from react.

dnsking avatar dnsking commented on April 19, 2024

This is still happening in [1.4.1]

from react.

Adam-Collier avatar Adam-Collier commented on April 19, 2024

Same here using 1.4.0!

from react.

lmichailian avatar lmichailian commented on April 19, 2024

Some news on this ?

from react.

rektdeckard avatar rektdeckard commented on April 19, 2024

@lmichailian can you provide details on your environment, bundler, and usage? As stated before, the current version of this package is tree-shakeable, but that does not mean your bundler can do it.

from react.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.