Skip to content

feat: add vite to bundle #740

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

Merged
merged 10 commits into from
Nov 3, 2022
Merged

feat: add vite to bundle #740

merged 10 commits into from
Nov 3, 2022

Conversation

joshuaellis
Copy link
Contributor

@joshuaellis joshuaellis commented Nov 1, 2022

What does it do?

This PR does a couple things:

  • Adds vite as the bundler for the packages
  • Consolidates deps / devDeps e.g. there were some devDeps in deps & some devDeps we weren't using in certain areas or at all

Ideally, I'd like to lift out storybook into it's own docs folder and make that isolated from the packages so we have to import { Select } from '@strapi/design-system' so that

  1. we can be sure the public facing package works as intended
  2. remove unnecessary devDeps from the design-system package and keep it tidier in the long run.

This would require moving all the stories around and I want to get the opinion on it before actioning.

Why is it needed?

Because moving to vite decreases bundle size by ~70-80% and therefore allows better tree shaking in other applications.
Keeping the packages tidy as possible to ensure we're not adding additional overheads where not required i.e. when people install our package imo they shouldn't be installing all the unneccessary devDeps for our storybook etc.

Notes

Because of the changes to type:module in the package.json, #741 needs to be merged first.

It also might be worth releasing a beta of this prior to stable to ensure it correctly works with cloud and cms.
Therefore, we could set up a beta branch – thoughts?

@joshuaellis joshuaellis added the pr: chore This PR contains chore tasks (cleanups, configs, tooling...) label Nov 1, 2022
@vercel
Copy link

vercel bot commented Nov 1, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
design-system ✅ Ready (Inspect) Visit Preview Nov 3, 2022 at 11:00AM (UTC)
design-system-website ✅ Ready (Inspect) Visit Preview Nov 3, 2022 at 11:00AM (UTC)

Copy link
Contributor

@gu-stav gu-stav left a comment

Choose a reason for hiding this comment

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

Overall this looks really tidy 💅🏼

I found only one thing that I'm not sure of: dist/index.cjs contains only require statements and not the whole bundle. Is that intentional? Would e.g. webpack resolve these dependencies even if we do not transpile node_modules and consume cjs files? I think in the ESM case it does, but I'm not sure about cjs.

Copy link
Contributor

@gu-stav gu-stav left a comment

Choose a reason for hiding this comment

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

I'm good with these changes. Thanks again @joshuaellis for pushing it forward 🚀

I think in terms of merge/ release I'd prefer if we'd release 1.26 asap followed by a 1.3 alpha/ beta release, so that both (cloud and cms) can pull it in to see if that works well.

What do you think?

@joshuaellis
Copy link
Contributor Author

I think in terms of merge/ release I'd prefer if we'd release 1.26 asap followed by a 1.3 alpha/ beta release, so that both (cloud and cms) can pull it in to see if that works well.

What do you think?

I agree, I'll try to get 1.2.6 released today as there's bits for relations that we need, then when people are happy with this PR we should do a beta release of 1.3 👍🏼 check it works across cloud and admin then release stable.

Copy link
Collaborator

@HichamELBSI HichamELBSI left a comment

Choose a reason for hiding this comment

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

Good job @joshuaellis !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr: chore This PR contains chore tasks (cleanups, configs, tooling...)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants