question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can tree shaking be improved for named imports?

See original GitHub issue

If I import

import { Github } from "@icons-pack/react-simple-icons";

webpack packs whole library (2MB+).

If i import only one file

import  Github  from "@icons-pack/react-simple-icons/lib/Github";

only icon I need (few kB).

I would expect for named imports to get tree shaken and pack only files that are needed.

Thanks for the lib, btw 😉

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:8
  • Comments:8 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
pomalicommented, May 6, 2020

Version 3.0.0-alpha.0 looks fine to me, tree shaking works. 😃

2reactions
wootsbotcommented, May 2, 2020

@pomali We have a Pr #39 with the fix of the issue that I report.

Thanks @pomali for your issue, any collaboration is free to contribute whatever it wants.

wait for the new version…

Read more comments on GitHub >

github_iconTop Results From Across the Web

Reduce JavaScript payloads with tree shaking - web.dev
In production builds, webpack can be configured to "shake" off exports from ES6 modules that weren't explicitly imported, making those production builds ...
Read more >
Tree-Shaking: A Reference Guide - Smashing Magazine
It will split all member and named exports into default exports, allowing the modules to be evaluated individually. It also has a configuration ......
Read more >
Tree shaking and code splitting in webpack - LogRocket Blog
Tree shaking dynamic imports​​ Dynamic imports resolve the entire module — with its default and named exports — without tree shaking unused  ......
Read more >
JavaScript tree shaking, like a pro | by Daniel Brain - Medium
Tree shaking in JavaScript is becoming an essential practice, to avoid large bundle sizes and improve performance.
Read more >
Tree Shaking - webpack
Tree shaking is a term commonly used in the JavaScript context for dead-code elimination. It relies on the static structure of ES2015 module...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found