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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What I did
closes ZupIT/beagle-web-core#288
I reduced the size of the Beagle React library by removing the dependencies
showdown
andlodash
.How I did it
Showdown
I removed the component
markdown
so that the dependencyshowdown
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:
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
markdown
and the dependencyshowdown
so beagle-react can have a smaller footprint.