Skip to content
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

chore!: reduce bundle size #346

Merged
merged 4 commits into from
Apr 15, 2022
Merged

Conversation

matthieuh
Copy link
Contributor

@matthieuh matthieuh commented Apr 8, 2022

Description

Done in this PR:

Dependency changes

Dependency Version State
@babel/plugin-transform-react-pure-annotations ^7.16.7 Added
@rollup/plugin-babel ^5.3.1 Added
rollup ^2.33.1 -> ^2.70.1 Updated
rollup-plugin-url Removed

Breaking changes

  • Fonts have to be imported into your main project

How to test?

  1. On a basic Next.js project add config.resolve.alias.react = path.resolve(__dirname, 'node_modules/react') in the custom webpack config. Use some components from Faency both in _app.ts and in some nextjs page (and be sure there are some you are not using).
  2. In the Faency repo run npm run build
  3. In the Faency repo run yarn link
  4. In the Next.js repo run yarn link @traefiklabs/faency
  5. In the Next.js repo run yarn build
  6. Analyze .next folder and see if faency components that you are not using are not present. @next/bundle-analyzer can be a good way to analyze it.

Good PR checkboxes

  • Change has been tested
  • Added/Updated tests
  • Added/Updated stories
  • PR follows conventions
  • Labels are set
  • Project is linked

Good Review checkboxes

ℹ️ Copy the snippet and paste in the review field to fill it
- [ ] I've tested the changes
- [ ] I've agreed on the unit tests (soon to come)
- [ ] I've checked the stories
- [ ] I've read the code and understood it
- [ ] I don't have any more questions
- [ ] I've described any optional improvements
- [ ] I checked PR follows [conventions](https://github.com/traefik/faency#how-to-contribute)

@matthieuh matthieuh force-pushed the fix/tree-shaking branch 2 times, most recently from b9fb625 to dcc8043 Compare April 8, 2022 10:09
@matthieuh matthieuh changed the title chore!: tree shaking + remove fonts chore!: reduce bundle size using Faency in production Apr 8, 2022
@matthieuh matthieuh changed the title chore!: reduce bundle size using Faency in production chore!: reduce bundle size using lib in production Apr 8, 2022
@matthieuh matthieuh changed the title chore!: reduce bundle size using lib in production chore!: reduce bundle size Apr 8, 2022
@matthieuh matthieuh marked this pull request as ready for review April 8, 2022 13:05
components/AriaTable/AriaTable.stories.tsx Outdated Show resolved Hide resolved
components/Table/Table.tsx Outdated Show resolved Hide resolved
Copy link
Contributor

@paulocfjunior paulocfjunior left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before:
Screen Shot 2022-04-11 at 01 03 24

After:
Screen Shot 2022-04-11 at 01 02 08

@paulocfjunior
Copy link
Contributor

@matthieuh I think we can also get rid of the types folder, as it's currently only used to define namespaces for the fonts.

Copy link
Contributor

@seedy seedy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Before
    image

  • After
    image

components/Button/Button.tsx Outdated Show resolved Hide resolved
@traefiker traefiker merged commit 27606f6 into traefik:master Apr 15, 2022
@matthieuh matthieuh deleted the fix/tree-shaking branch April 15, 2022 07:50
@traefiker
Copy link
Contributor

🎉 This PR is included in version 4.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants