Reputation: 161
I import only 10 font-awesome icons like
import FaClipboardList from 'react-icons/fa
but webpack is downloading all font-awesome icons. Is it possible to download only what I require?
Upvotes: 1
Views: 292
Reputation: 26
Had a similar problem with react-icon v3. Apparently they used .mjs
files and webpack wasn't able to perform tree shaking on them. What helped is adding this extension to the webpack's resolve
list. (only worked on webpack 4).
resolve: {
extensions: ['.mjs', '.js'],
...
},
Apparently they stopped using .mjs
in newer releases, but they also have some problems, so I decided to stick with v3 for a time being.
Here is long thread regarding this issue. https://github.com/react-icons/react-icons/issues/154
Upvotes: 1