React-fontawesome: Increased build time from ~15s to ~5min

Created on 4 Oct 2018  路  5Comments  路  Source: FortAwesome/react-fontawesome

Hi, with my current webpack/babel config, adding this library drastically increased my build time from production ( The development time is fine. ).

  • Am I the only one ?

    • Is there something we can do about it ?

I'm using webpack 4.20.2 with babel 7.1.2

All 5 comments

Similar for me. I noticed it happens mainly for @fortawesome/free-solid-svg-icons package. One such import adds ~25s to build time, while @fortawesome/free-regular-svg-icons adds only ~3s.

Webpack 4.20.2

There's a section in docs about it.

Using terser-webpack-plugin as minimizer should do the trick:

npm i -D terser-webpack-plugin

webpack.config.js:

const TerserPlugin = require('terser-webpack-plugin');

module.exports = {
  //...
  optimization: {
    minimizer: [new TerserPlugin()]
  }
};

Thanks for the tip !
I ended up using [email protected] which solved building time issues for me.

Problem with react-icons is they don't support tree shaking, yet :(

The issue is most likely an UglifyJS bug. Check out https://fontawesome.com/how-to-use/with-the-api/other/tree-shaking we have more information there.

The issue is most likely an UglifyJS bug. Check out fontawesome.com/how-to-use/with-the-api/other/tree-shaking we have more information there.

I meant react-isons. FontAwesome tree shaking works fine.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Ethan-Arrowood picture Ethan-Arrowood  路  4Comments

gtkatakura-bysoft picture gtkatakura-bysoft  路  5Comments

lightninglu10 picture lightninglu10  路  5Comments

johnnunns picture johnnunns  路  4Comments

lehresman picture lehresman  路  6Comments