GithubHelp home page GithubHelp logo

Comments (11)

ThomasBem avatar ThomasBem commented on May 12, 2024 3

We came back to our app recently where we use one of your spinners as our main loading animation. Updated to 0.4.3 and changed the import like you said and now our bundle size dropped by 50KB.

Just wanted to say thanks! 👍

from react-spinners.

ThomasBem avatar ThomasBem commented on May 12, 2024

Would also be interested in this! Currently react-spinners is 9% of our small apps total bundle size.

Love the spinners though! RingLoader is awesome :)

from react-spinners.

davidhu2000 avatar davidhu2000 commented on May 12, 2024

@archansel @ThomasBem, I ran a quick test, looks you like can import just one.

import BarLoader from 'react-spinners/dist/spinners/BarLoader';

Trying to see how I can remove the /dist/spinners part`.

import { BarLoader } from 'react-spinners';: 51.23 KB
import BarLoader from 'react-spinners/dist/spinners/BarLoader';: 47.44 KB

The file sizes are the size after gzip. I used create-react-app and just added the loader and build the production build.

Can you guys give that a try and see if the bundle size is reduced?

from react-spinners.

Dman757 avatar Dman757 commented on May 12, 2024

@davidhu2000 Figured I would chime in to confirm this worked on my end. I used source-map-explorer for a quick test. https://www.npmjs.com/package/source-map-explorer

I'm only using BarLoader and PulseLoader
import PulseLoader from 'react-spinners/dist/spinners/PulseLoader';
import BarLoader from 'react-spinners/dist/spinners/BarLoader';

Before
Before

After
After

from react-spinners.

davidhu2000 avatar davidhu2000 commented on May 12, 2024

@GuillaumeCisco Just merged in your PR, but looks like single loader import isn't working.

I'm looking at possible solutions, not sure why. I had to deprecate 0.4.0. We need to push out a patch for this.

from react-spinners.

davidhu2000 avatar davidhu2000 commented on May 12, 2024

I just published a patch 0.4.1 that removes the single loader import from the readme. So hopefully very few people uses 0.4.0.

from react-spinners.

davidhu2000 avatar davidhu2000 commented on May 12, 2024

looks like the issue is you need to import BarLoader from 'react-spinners/dist/BarLoader';

from react-spinners.

GuillaumeCisco avatar GuillaumeCisco commented on May 12, 2024

from react-spinners.

davidhu2000 avatar davidhu2000 commented on May 12, 2024

This is fixed in >= 0.4.2

from react-spinners.

kifirkin avatar kifirkin commented on May 12, 2024

@davidhu2000 Can't use this import method with typescript. I've got error: Could not find a declaration file for module 'react-spinners/GridLoader'.

from react-spinners.

davidhu2000 avatar davidhu2000 commented on May 12, 2024

hmm, @alexmironof can you open a new issue? This feels like a different issue that the current issue.

from react-spinners.

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.