Skip to content

fix(core): exclude unused @tiptap collab deps from optimizeDeps#780

Open
mvanhorn wants to merge 5 commits intoemdash-cms:mainfrom
mvanhorn:fix/771-tiptap-collaboration-optimizedeps
Open

fix(core): exclude unused @tiptap collab deps from optimizeDeps#780
mvanhorn wants to merge 5 commits intoemdash-cms:mainfrom
mvanhorn:fix/771-tiptap-collaboration-optimizedeps

Conversation

@mvanhorn
Copy link
Copy Markdown
Contributor

What does this PR do?

A fresh npm create emdash@latest followed by yarn dev fails during dependency optimization on @tiptap/extension-collaboration and @tiptap/y-tiptap (#771):

[ERROR] Could not resolve "@tiptap/extension-collaboration"

Neither package is imported by any source file in this repo (verified by grep across packages/admin/src, packages/core/src, etc.), and neither is declared in packages/admin/package.json or in the catalog inside pnpm-workspace.yaml. They show up in the pnpm store as transitive installs only.

What's happening: Vite's esbuild dependency scanner follows a non-static import() somewhere inside @tiptap/react or @tiptap/starter-kit that references these two collaboration packages, and the scan fails because they're not installed. The dev server never finishes booting on a clean checkout.

This PR appends both packages to the optimizeDeps.exclude array in both the Cloudflare and non-Cloudflare branches of the Astro integration's vite-config.ts, so esbuild skips resolving them entirely. The repo continues to work fine with the 17 @tiptap/* packages it actually uses.

Closes #771

Type of change

  • Bug fix
  • Feature (requires maintainer-approved Discussion)
  • Refactor (no behavior change)
  • Translation
  • Documentation
  • Performance improvement
  • Tests
  • Chore (dependencies, CI, tooling)

Checklist

  • I have read CONTRIBUTING.md
  • pnpm typecheck passes — N/A locally; the change is a string-array literal addition with no type changes.
  • pnpm lint passes (pnpm --silent lint:json reported zero diagnostics)
  • pnpm test passes (or targeted tests for my change) — N/A; no test exercises optimizeDeps shape directly. End-to-end verification is npm create emdash@latest && yarn dev succeeds.
  • pnpm format has been run
  • I have added/updated tests for my changes (if applicable) — see above
  • User-visible strings in the admin UI are wrapped for translation — N/A (no admin UI strings)
  • I have added a changeset (.changeset/rude-seas-guess.md, emdash patch)
  • New features link to an approved Discussion — N/A (bug fix)

AI-generated code disclosure

  • This PR includes AI-generated code

Developed with Claude Code orchestrating Codex CLI (gpt-5.5 high). The change is a 2-element addition to two existing optimizeDeps.exclude arrays plus a one-line comment above each.

Screenshots / test output

$ pnpm --silent lint:json
0 diagnostics

To verify end-to-end on a maintainer's machine:

  1. npm create emdash@latest (or pnpm create emdash@latest)
  2. cd <project> && yarn dev
  3. Before this PR: dev server fails with Could not resolve "@tiptap/extension-collaboration".
  4. After this PR: dev server starts cleanly.

Vite's esbuild scanner follows a non-static import() inside
@tiptap/react or @tiptap/starter-kit that references
@tiptap/extension-collaboration and @tiptap/y-tiptap. Neither package
is imported by source code in this repo and neither is declared in
packages/admin/package.json or the pnpm-workspace catalog, so a fresh
install fails dependency optimization with "Could not resolve
@tiptap/y-tiptap" before the dev server is reachable.

Append both packages to optimizeDeps.exclude in both the Cloudflare and
non-Cloudflare branches of the Astro integration's vite-config.ts so
esbuild skips resolving them. The repo continues to work correctly with
the @tiptap/* packages it actually uses.

Fixes emdash-cms#771
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Apr 26, 2026

🦋 Changeset detected

Latest commit: f691973

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 13 packages
Name Type
emdash Patch
@emdash-cms/cloudflare Patch
@emdash-cms/fixture-perf-site Patch
@emdash-cms/perf-demo-site Patch
@emdash-cms/cache-demo-site Patch
@emdash-cms/admin Patch
@emdash-cms/auth Patch
@emdash-cms/blocks Patch
@emdash-cms/gutenberg-to-portable-text Patch
@emdash-cms/x402 Patch
create-emdash Patch
@emdash-cms/auth-atproto Patch
@emdash-cms/plugin-embeds Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Apr 26, 2026

Open in StackBlitz

@emdash-cms/admin

npm i https://pkg.pr.new/@emdash-cms/admin@780

@emdash-cms/auth

npm i https://pkg.pr.new/@emdash-cms/auth@780

@emdash-cms/blocks

npm i https://pkg.pr.new/@emdash-cms/blocks@780

@emdash-cms/cloudflare

npm i https://pkg.pr.new/@emdash-cms/cloudflare@780

emdash

npm i https://pkg.pr.new/emdash@780

create-emdash

npm i https://pkg.pr.new/create-emdash@780

@emdash-cms/gutenberg-to-portable-text

npm i https://pkg.pr.new/@emdash-cms/gutenberg-to-portable-text@780

@emdash-cms/x402

npm i https://pkg.pr.new/@emdash-cms/x402@780

@emdash-cms/plugin-ai-moderation

npm i https://pkg.pr.new/@emdash-cms/plugin-ai-moderation@780

@emdash-cms/plugin-atproto

npm i https://pkg.pr.new/@emdash-cms/plugin-atproto@780

@emdash-cms/plugin-audit-log

npm i https://pkg.pr.new/@emdash-cms/plugin-audit-log@780

@emdash-cms/plugin-color

npm i https://pkg.pr.new/@emdash-cms/plugin-color@780

@emdash-cms/plugin-embeds

npm i https://pkg.pr.new/@emdash-cms/plugin-embeds@780

@emdash-cms/plugin-forms

npm i https://pkg.pr.new/@emdash-cms/plugin-forms@780

@emdash-cms/plugin-webhook-notifier

npm i https://pkg.pr.new/@emdash-cms/plugin-webhook-notifier@780

commit: f691973

@mvanhorn mvanhorn marked this pull request as draft April 26, 2026 22:43
…xclusion

Calls createViteConfig with both Cloudflare and Node mock adapters and
asserts that the resulting optimizeDeps.exclude (and ssr.optimizeDeps
.exclude on the Cloudflare path) carries @tiptap/extension-collaboration
and @tiptap/y-tiptap. Verified to fail without the fix and pass with
it.

Also picks up oxfmt's reformatting of the inline exclude array on the
SSR branch (one-liner instead of multi-line list) — purely cosmetic.

Refs emdash-cms#771
@github-actions github-actions Bot added size/M and removed size/S labels Apr 26, 2026
@mvanhorn mvanhorn marked this pull request as ready for review April 26, 2026 22:56
Copy link
Copy Markdown
Collaborator

@ascorbic ascorbic left a comment

Choose a reason for hiding this comment

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

Thanks! Just one small note

Comment on lines +400 to +403
"virtual:emdash",
"@tiptap/extension-collaboration",
"@tiptap/y-tiptap",
]
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Instead of repeating the array, could you define it as a constant used in both places?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[ERROR] Could not resolve "@tiptap/y-tiptap"

2 participants