Skip to content

Docs: pre-bundle clipboard for the dev server - #43135

Merged
julien-deramond merged 1 commit into
mainfrom
v6-jd-docs-dev-clipboard
Oct 20, 2026
Merged

julien-deramond merged 1 commit into
mainfrom
v6-jd-docs-dev-clipboard

Conversation

@julien-deramond

Copy link
Copy Markdown
Member

On main, npm run docs-serve loads the docs pages, but their scripts don't run. The browser console shows:

Uncaught SyntaxError: The requested module '/@fs/…/node_modules/clipboard/dist/clipboard.js' does not provide an export named 'default'

site/astro.config.ts excludes @twbs/bui from Vite's dependency pre-bundling, so Vite serves bui's sources as they are. Its src/browser/clipboard.ts imports the clipboard package, which only ships CommonJS, and the browser can't read a default export from it. The module fails to load, and the docs scripts that import it stop with it, so the copy buttons do nothing in dev. npm run docs-build isn't affected, because the production build bundles everything.

This PR adds @twbs/bui > clipboard to optimizeDeps.include. Vite pre-bundles clipboard on its own and turns it into an ES module with a default export, while the rest of @twbs/bui is still served from source. The production build doesn't change.

I checked it with @twbs/bui 0.1.4 and Astro 7.3.8, starting from an empty Vite cache. On main, the Button page throws the error above and its copy buttons never get their tooltip. With this change the error is gone, and clicking a copy button shows "Copied!". npm run docs-build passes.

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@julien-deramond julien-deramond added docs Documentation site and its content v6 v6, the main branch labels Oct 20, 2026
@github-project-automation github-project-automation Bot moved this to Inbox in v6.0.0 Oct 20, 2026
@julien-deramond
julien-deramond merged commit cf1da65 into main Oct 20, 2026
13 checks passed
@julien-deramond
julien-deramond deleted the v6-jd-docs-dev-clipboard branch October 20, 2026 19:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Documentation site and its content v6 v6, the main branch

Projects

Status: Inbox

Development

Successfully merging this pull request may close these issues.

1 participant