wmira / react-icons-kit

React Svg Icons
https://react-icons-kit.vercel.app/
MIT License
370 stars 45 forks source link

Tree Shaking? #38

Closed notflip closed 4 years ago

notflip commented 5 years ago

Is this package optimized so that if 1 have 1 icon from 1 pack, it doesn't load all packs, or all icons in a pack? Thanks!

wmira commented 5 years ago

Hi Miguel,

You can import the icon individually for now as per the import when you do icon selection. The iconlib/index.js file unfortunately is not an es2015 module.

So you can:

import {ic_accessibility} from 'react-icons-kit/md/ic_accessibility'

Plan is to have an es2015 module in the future.

Warren

On Tue, Dec 4, 2018, 1:36 PM Miguel Stevens <notifications@github.com wrote:

Is this package optimized so that if 1 have 1 icon from 1 pack, it doesn't load all packs, or all icons in a pack? Thanks!

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/wmira/react-icons-kit/issues/38, or mute the thread https://github.com/notifications/unsubscribe-auth/AAcmEEGYSvNp07EovhJkMaap80dMlPW-ks5u1gn1gaJpZM4Y_9Qa .

thomassuckow commented 5 years ago

In case this eslint config helps anyone:

'no-restricted-imports': [
      'error',
      {
        paths: [
          {
            name: 'react-icons-kit/entypo',
            message: 'Please use react-icons-kit/entypo/your-icon instead.',
          },
          {
            name: 'react-icons-kit/fa',
            message: 'Please use react-icons-kit/fa/your-icon instead.',
          },
          {
            name: 'react-icons-kit/feather',
            message: 'Please use react-icons-kit/feather/your-icon instead.',
          },
          {
            name: 'react-icons-kit/icomoon',
            message: 'Please use react-icons-kit/icomoon/your-icon instead.',
          },
          {
            name: 'react-icons-kit/iconic',
            message: 'Please use react-icons-kit/iconic/your-icon instead.',
          },
          {
            name: 'react-icons-kit/ikons',
            message: 'Please use react-icons-kit/ikons/your-icon instead.',
          },
          {
            name: 'react-icons-kit/ionicons',
            message: 'Please use react-icons-kit/ionicons/your-icon instead.',
          },
          {
            name: 'react-icons-kit/linea',
            message: 'Please use react-icons-kit/linea/your-icon instead.',
          },
          {
            name: 'react-icons-kit/md',
            message: 'Please use react-icons-kit/md/your-icon instead.',
          },
          {
            name: 'react-icons-kit/metrize',
            message: 'Please use react-icons-kit/metrize/your-icon instead.',
          },
          {
            name: 'react-icons-kit/noto_emoji_regular',
            message:
              'Please use react-icons-kit/noto_emoji_regular/your-icon instead.',
          },
          {
            name: 'react-icons-kit/oct',
            message: 'Please use react-icons-kit/oct/your-icon instead.',
          },
          {
            name: 'react-icons-kit/typicons',
            message: 'Please use react-icons-kit/typicons/your-icon instead.',
          },
        ],
      },
    ],
wmira commented 4 years ago

closing this @thomassuckow thanks for the linter