ui icon indicating copy to clipboard operation
ui copied to clipboard

feat: Added vite esm build for Nuxt UI playground

Open jd-solanki opened this issue 4 months ago โ€ข 4 comments

๐Ÿ”— Linked issue

None

Here's the playground link: https://nuxt-ui-playground.netlify.app/

โ“ Type of change

  • [ ] ๐Ÿ“– Documentation (updates to the documentation or readme)
  • [ ] ๐Ÿž Bug fix (a non-breaking change that fixes an issue)
  • [ ] ๐Ÿ‘Œ Enhancement (improving an existing functionality)
  • [ ] โœจ New feature (a non-breaking change that adds functionality)
  • [x] ๐Ÿงน Chore (updates to the build process or auxiliary tools and libraries)
  • [ ] โš ๏ธ Breaking change (fix or feature that would cause existing functionality to change)

๐Ÿ“š Description

For Nuxt UI playground we are using Vue Repl. It requires lib to have compiled components in ESM so we can import them via import map: https://github.com/vuejs/repl/issues/234#issuecomment-2127354755

Hence, added new build setup that compiles components using vite.

๐Ÿ“ Checklist

  • [x] I have linked an issue or discussion.
  • [x] I have updated the documentation accordingly. Not needed

jd-solanki avatar Sep 17 '25 18:09 jd-solanki

@danielroe Do you know if there's a way to achieve this through the current build process? ๐Ÿค”

benjamincanac avatar Sep 18 '25 08:09 benjamincanac

I would guess it would significantly increase the build size. but if that's not an issue, you can likely add each component as an 'entry' (using a globbing util to get them all) in build.config. you will also need to ensure that rollup-plugin-vue (or vite-plugin-vue) is added to the rollup config, which might have to be in an unbuild hook, if there's no option to do so directly.

danielroe avatar Sep 18 '25 08:09 danielroe

Doesn't the build size increases with both solutions? We would need to publish the result of this build as well no? ๐Ÿค”

benjamincanac avatar Sep 18 '25 08:09 benjamincanac

@danielroe @benjamincanac

How about distributing it as a separate package? This is only needed for the playground. Maybe like @nuxt/ui-esm?

BTW, the goal is that it shouldn't affect existing build & distribution.

jd-solanki avatar Sep 18 '25 09:09 jd-solanki