influxdata / influxdata/giraffe

Issue with Tree Shaking

Open
#462 1 comment 0 reactions 0 assignees View on GitHub
team/ui
Dominant language
TypeScript
Stars
189
Forks
33
Avg merge
3d 15h
Merged PRs (30d)
4

Description

I'm having an issue with tree shaking, and I'm not sure why. I'm not certain this is a bug, but it may be. I'm using Create React App, and have a very large bundle. I've simplified the problem by just importing two modules, and still i have a bloated bundle.

Here's my only import line for giraffe:

```
import { newTable, Table } from '@influxdata/giraffe';
```

And here's how the bundle looks:

![image](https://user-images.githubusercontent.com/239798/106078414-9d181f80-60d0-11eb-8761-59d41f89bc02.png)

I took a peek into the code, and it seems as though they're es6 exports that should allow for tree shaking. Am I missing something?

Thanks!

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the Create React App bundle with the reported `@influxdata/giraffe` import of `newTable` and `Table`, then inspect the generated bundle and package exports. Trace why unrelated code remains included and document a confirmed cause or reproducible limitation; the issue is resolved when the tree-shaking behavior is explained and verified.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
build-system, frontend, performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.