🌙 Moon - Vue 3 component library starter [Vite]

Hello Dev.to community đź‘‹

Today I wanted to share with you my latest side-project, a Vue 3 component library powered by Vite.

As some of you might know Vue 3 is out and it's doing a great job offering a more lightweight alternative to React. I decided to dig into it only to find that most resources on the web are still talking about Vue 2.

Having had to work on a component library at my job (using Vue 2) I decided to try and create one from scratch using the latest tech avaliable for Vue 3.

My goal was to provide a perfectionist's dream setup with the fewest dependencies possible but including those that are really valuable for development.

After researching about the best way to achieve this goal I settled with Vite.

Using Vite's library mode and VitePress (a Vite powered VuePress) I created a low config component library with documentation included. I called it 🌙 Moon. I believe my setup is easy to replicate and could provide value for others trying to create a component library for Vue 3. The fact that Vite uses esbuild also provides a great developer experience with blazing fast build speeds.

Currently the component library includes the following utilities:

  1. ES Modules + UMD build
  2. ESLint + Prettier setup with individual commands
  3. rollup-plugin-visualizer that allows you to check your bundle size breakdown
  4. Blazing fast build speed.
  5. Least amount of config possible

There are 13 components available and I intend to add some more that I feel are essential to most interfaces (like Tabs and Selects). These components were built with accessibility in mind, use as little JS as possible and try to keep the HTML markup as light as possible as well.

I have already identified some possible improvements but I haven't had much time to work on them. Even though it's still a work in progress I am sure it will be of help for those researching about this topic.

Feel free to fork it or take a look under the hood and get some inspiration for your own projects

28