Skip to content
This repository has been archived by the owner on Jun 1, 2024. It is now read-only.

Removes the markdown component and other dependencies #159

Merged
merged 6 commits into from
Oct 22, 2020

Conversation

Tiagoperes
Copy link
Contributor

@Tiagoperes Tiagoperes commented Oct 21, 2020

What I did

closes ZupIT/beagle-web-core#288

I reduced the size of the Beagle React library by removing the dependencies showdown and lodash.

How I did it

Showdown

I removed the component markdown so that the dependency showdown could be removed. This dependency is way too big and this component probably won't ever be used. There's no reason to increase the size of Beagle only because of this component.

Since the component markdown is required in the Beagle Playground, it has been transferred there. Please, also accept this PR.

Lodash

I removed the lodash dependency, the only places using it didn't needed it at all.

React-dom

I also removed the explicit dependency for react-dom. This was wrong, since Beagle must use the react-dom of the application and not introduce a new one, i.e. it should be a peer dependency and not a direct dependency. I added both react and react-dom to the dev-dependencies so we can still link beagle-react (there is a problem when you link a react library without also linking react and react-dom).

For making it easier to link beagle-react, I added a new script yarn link:beagle that creates all necessary links at once.

The changes to the dependency react-dom didn't affect the size, but they corrected a bug that could possibly arise when using different versions of React.

Result

I created three apps with create-react-app (React 16.14). One without Beagle, another with Beagle 1.3.0 and another with Beagle at this branch (fix/lib-size). I compared the sizes of each generated bundle (production) using 4 different methods:

  • directory size: raw size of the bundle directory
  • initial payload: when opening the application in a browser, how much data it needs to download? The value were taken from the network tab of Chrome dev tools.
  • webpack bundle analyzer: I used this tool to measure the bundle size. I used the measuring "Parsed" to get these results, which is the size of the minified files.
  • webpack bundle analyzer (gzip): I used this tool to measure the bundle size. I used the measuring "Gzipped" to get these results, which is the size of the compressed minified files.
Without Beagle With Beagle 1.3.0 With Beagle at this branch
Directory size 557KB 2.4MB 1.3MB
Initial payload 146KB 469KB 307KB
Webpack bundle analyzer 130KB 447KB 289KB
Webpack bundle analyzer (gzip) 41KB 134KB 85KB

Related Pull Requests

How to verify it

To verify the sizes, you must compare the sizes of the same application with and without beagle.
To verify everything keeps working as intended, you can visit the playground beta, which represents this exact branch.

Description for the changelog

  • removed the component markdown and the dependency showdown so beagle-react can have a smaller footprint.

@Tiagoperes Tiagoperes changed the title Fix/lib size Removes big dependencies Oct 22, 2020
@Tiagoperes Tiagoperes changed the title Removes big dependencies Removes the markdown component and other dependencies Oct 22, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Beagle-WEB libs are way too big
3 participants