fix(core): exclude unused @tiptap collab deps from optimizeDeps#780
fix(core): exclude unused @tiptap collab deps from optimizeDeps#780mvanhorn wants to merge 6 commits into
Conversation
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 detectedLatest commit: 83264e4 The changes in this PR will be included in the next version bump. This PR includes changesets to release 13 packages
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 |
@emdash-cms/admin
@emdash-cms/auth
@emdash-cms/blocks
@emdash-cms/cloudflare
emdash
create-emdash
@emdash-cms/gutenberg-to-portable-text
@emdash-cms/x402
@emdash-cms/plugin-ai-moderation
@emdash-cms/plugin-atproto
@emdash-cms/plugin-audit-log
@emdash-cms/plugin-color
@emdash-cms/plugin-embeds
@emdash-cms/plugin-forms
@emdash-cms/plugin-webhook-notifier
commit: |
…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
ascorbic
left a comment
There was a problem hiding this comment.
Thanks! Just one small note
| "virtual:emdash", | ||
| "@tiptap/extension-collaboration", | ||
| "@tiptap/y-tiptap", | ||
| ] |
There was a problem hiding this comment.
Instead of repeating the array, could you define it as a constant used in both places?
|
This PR has been inactive for 14 days. It will be closed automatically in 7 days if there is no further activity. If you're still working on this, please push an update or leave a comment. |
…mdash-cms#780) Per @ascorbic's review on emdash-cms#780: extract the repeated @tiptap/* array into a single constant and reuse it in both the SSR optimizeDeps block and the top-level optimizeDeps exclude (both cloudflare and non-cloudflare branches). Removes 3 duplicated explanatory comments; the one on the constant covers it. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Done in 83264e4. Extracted Thanks for the review. |
What does this PR do?
A fresh
npm create emdash@latestfollowed byyarn devfails during dependency optimization on@tiptap/extension-collaborationand@tiptap/y-tiptap(#771):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 inpackages/admin/package.jsonor in the catalog insidepnpm-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/reactor@tiptap/starter-kitthat 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.excludearray in both the Cloudflare and non-Cloudflare branches of the Astro integration'svite-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
Checklist
pnpm typecheckpasses — N/A locally; the change is a string-array literal addition with no type changes.pnpm lintpasses (pnpm --silent lint:jsonreported zero diagnostics)pnpm testpasses (or targeted tests for my change) — N/A; no test exercises optimizeDeps shape directly. End-to-end verification isnpm create emdash@latest && yarn devsucceeds.pnpm formathas been run.changeset/rude-seas-guess.md,emdashpatch)AI-generated code disclosure
Developed with Claude Code orchestrating Codex CLI (gpt-5.5 high). The change is a 2-element addition to two existing
optimizeDeps.excludearrays plus a one-line comment above each.Screenshots / test output
To verify end-to-end on a maintainer's machine:
npm create emdash@latest(orpnpm create emdash@latest)cd <project> && yarn devCould not resolve "@tiptap/extension-collaboration".