-
-
Notifications
You must be signed in to change notification settings - Fork 8.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Webpack@4 is not tree shaking a file exporting SVGs (font-awesome@5) #6724
Comments
This is not a webpack bug. Packages must be designed with tree shaking in mind. If they have function calls with side effects then code must be retained in the event it is used. I am not a fan of debugging commercial software, but if you look at
If it is commented out then the final bundle will be 300K smaller. |
Thanks a lot for the solution @kzc ! |
The package In Font Awesome 5.1 (in preview currently), the equivalent package is called |
Do you want to request a feature or report a bug?
Bug
What is the current behavior?
webpack@4
can't tree shaking the@fortawesome/fontawesome-free-solid
, even when I change theirnode_modules/@fortawesome/fontawesome-free-solid/package.json
adding the"sideEffects": false
.I have following this issue FortAwesome/react-fontawesome#70 making several tests but we can't find a solution.
Maybe you can help to the FortAwesome's team to reach a solution.
If the current behavior is a bug, please provide the steps to reproduce.
You can check the bug yourself using this repo: https://github.com/navarroaxel/fa-bundle-bug
What is the expected behavior?
webpack
should optimize the@fortawesome/fontawesome-free-solid
library exporting only one icon.If this is a feature request, what is motivation or use case for changing the behavior?
N/A
Please mention other relevant information such as the browser version, Node.js version, webpack version, and Operating System.
node@6 or node@8
webpack@3 or webpack@4
react@16.2
fortawesome/react-fontawesome@0.0.17
fortawesome/fontawesome-free-solid@5.0.8
OS: Ubuntu 17.10
The text was updated successfully, but these errors were encountered: