A
A
Alexander2019-01-14 12:51:09
webpack
Alexander, 2019-01-14 12:51:09

Do such imports inflate the bundle?

webpack4.

import Archive from '@icons/basic-24-archive_24';
import Message from '@icons/basic-24-message_24';
import Pin from '@icons/basic-24-pin_24';
import React from 'react';

const icons = {
    Archive,
    Message,
    Pin
};


export default (iconName) => {
    return React.createElement(icons[iconName] || Pin);
};

I'm interested in the question, if I request one icon using the exported function - will I have all 3 icons in the bundle or one?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
fl3nkey, 2019-01-14
@aleksand44

all 3.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question