Skip to content

chore: remove unused dependencies and bundle react-icons#2796

Open
nperez0111 wants to merge 3 commits into
mainfrom
chore/trim-unnecessary-dependencies
Open

chore: remove unused dependencies and bundle react-icons#2796
nperez0111 wants to merge 3 commits into
mainfrom
chore/trim-unnecessary-dependencies

Conversation

@nperez0111
Copy link
Copy Markdown
Contributor

@nperez0111 nperez0111 commented May 27, 2026

Summary

Remove unused/unnecessary dependencies across 11 packages in the monorepo, and bundle react-icons into build output for packages that use it so consumers no longer need to install it separately.

Changes

@blocknote/core

  • Removed @tiptap/extension-horizontal-rule (unused — divider block is custom implementation)
  • Removed @tiptap/extension-paragraph (unused — paragraph block is custom implementation)
  • Removed lib0 — replaced uuidv4() with native crypto.randomUUID() in 3 files

@blocknote/react

  • Removed lodash.merge + @types/lodash.merge (zero source imports — dead weight)
  • Removed @floating-ui/utils (never directly imported, only transitive)
  • Moved @types/use-sync-external-store to optionalDependencies
  • Bundled react-icons into build output (moved to devDeps, excluded from Vite externals)
  • Added local IconType type to avoid exposing react-icons in .d.ts output

@blocknote/code-block

  • Moved @blocknote/core to devDeps (type-only import, already a peerDep)
  • Moved @shikijs/types to devDeps (type-only import)

@blocknote/mantine

  • Bundled react-icons into build output (moved to devDeps, excluded from Vite externals)

@blocknote/shadcn

  • Removed autoprefixer (unused)

@blocknote/xl-ai

  • Removed @blocknote/mantine, @tiptap/core, react-dom, react from deps
  • Bundled react-icons into build output

@blocknote/server-util

  • Removed @tiptap/core (unused)
  • Moved y-prosemirror, y-protocols, yjs to devDeps (type-only or unused in src)

@blocknote/xl-email-exporter

  • Removed @blocknote/react, buffer from deps (unused)
  • Moved react, react-dom to devDeps (already peerDeps)
  • Moved react-email to devDeps (CLI tool, not runtime)

@blocknote/xl-multi-column

  • Removed prosemirror-tables, prosemirror-transform (unused)
  • Bundled react-icons into build output

@blocknote/xl-odt-exporter

  • Removed buffer (unused)

@blocknote/xl-pdf-exporter

  • Removed @blocknote/react, buffer, docx (all unused)

Impact

Reduces the number of transitive dependencies consumers need to install. The react-icons bundling means consumers of @blocknote/react, @blocknote/mantine, @blocknote/xl-ai, and @blocknote/xl-multi-column no longer need react-icons in their own node_modules.

Testing

  • Full monorepo build passes (pnpm run build — 18 projects, 0 errors)
  • @blocknote/core tests pass (27 files, 445 tests)

Summary by CodeRabbit

  • Chores

    • Cleaned up and reordered dependencies across multiple packages
    • Reclassified several packages' dependencies (moved some to dev/optional/peer)
  • Refactor

    • Switched ID generation to the Web Crypto API for runtime IDs
    • Added a shared local icon type and re-export for consistent icon usage
    • Updated build configs to ensure icon assets are bundled into library outputs
  • Tests

    • Made test UUID generation deterministic and restored original behavior after tests

Review Change Stack

@blocknote/core:
- Remove unused @tiptap/extension-horizontal-rule (custom divider block)
- Remove unused @tiptap/extension-paragraph (custom paragraph block)
- Remove lib0; replace lib0/random uuidv4 with crypto.randomUUID()
- Update YjsThreadStore test mock accordingly

@blocknote/react:
- Remove unused lodash.merge and @types/lodash.merge
- Remove unused @floating-ui/utils (transitive dep only)
- Move @types/use-sync-external-store to optionalDependencies
- Bundle react-icons into dist output (tree-shaken) instead of
  externalizing it, so consumers no longer need to install it
- Define local IconType to avoid leaking react-icons in .d.ts output
@vercel
Copy link
Copy Markdown

vercel Bot commented May 27, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
blocknote Error Error May 27, 2026 8:38pm
blocknote-website Error Error May 27, 2026 8:38pm

Request Review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 27, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 9d65c825-8dff-4f2c-b41d-3333c5e71865

📥 Commits

Reviewing files that changed from the base of the PR and between 29061a5 and 1def215.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (4)
  • packages/code-block/package.json
  • packages/core/src/comments/threadstore/yjs/YjsThreadStore.test.ts
  • packages/core/src/comments/threadstore/yjs/YjsThreadStore.ts
  • packages/server-util/package.json
💤 Files with no reviewable changes (1)
  • packages/core/src/comments/threadstore/yjs/YjsThreadStore.ts
🚧 Files skipped from review as they are similar to previous changes (3)
  • packages/core/src/comments/threadstore/yjs/YjsThreadStore.test.ts
  • packages/code-block/package.json
  • packages/server-util/package.json

📝 Walkthrough

Walkthrough

This PR replaces lib0's uuidv4 with crypto.randomUUID() across core code and tests, introduces a local IconType and re-exports it, updates components to use the new type, changes Vite bundling to include react-icons, and adjusts multiple package.json dependency entries.

Changes

Web Crypto UUID Migration

Layer / File(s) Summary
Core UUID Implementation Migration
packages/core/package.json, packages/core/src/extensions/Placeholder/Placeholder.ts, packages/core/src/extensions/tiptap-extensions/UniqueID/UniqueID.ts, packages/core/src/comments/threadstore/yjs/YjsThreadStore.ts
Remove lib0/uuidv4 usage and replace calls with crypto.randomUUID() for thread/comment IDs and editor placeholder selectors.
Test Mock Strategy Update
packages/core/src/comments/threadstore/yjs/YjsThreadStore.test.ts
Update tests to spy on and mock crypto.randomUUID() for deterministic UUID values instead of mocking lib0/random.

React Icon Type & Bundling

Layer / File(s) Summary
IconType Definition and Export
packages/react/src/icons.ts, packages/react/src/index.ts
Add exported IconType TypeScript alias and re-export it from the React package entrypoint.
Component Icon Type Imports
packages/react/src/components/FormattingToolbar/..., packages/react/src/components/SuggestionMenu/getDefaultReactSlashMenuItems.tsx
Switch component IconType imports to the new local icons.ts type instead of react-icons.
Build Config and Dependency Changes
packages/react/package.json, packages/react/vite.config.ts, packages/mantine/package.json, packages/mantine/vite.config.ts, packages/xl-ai/*, packages/xl-multi-column/*
Move certain packages between dependencies/devDependencies/optionalDependencies and update Vite/Rollup external rules so react-icons (and subpaths) are bundled rather than treated as external across multiple package builds.

Manifest and Dependency Tidying

Layer / File(s) Summary
Package manifest updates
packages/code-block/package.json, packages/server-util/package.json, packages/shadcn/package.json, packages/xl-email-exporter/package.json, packages/xl-odt-exporter/package.json, packages/xl-pdf-exporter/package.json
Reorder dependency entries, remove or relocate specific deps (e.g., autoprefixer, buffer), and move some yjs-related packages between dependencies and devDependencies.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested reviewers

  • matthewlipski

Poem

🐰 I nibble keys and code so bright,

crypto UUIDs in the night.
Icons typed close to home, not far,
Bundled in builds like a cozy star.
Hops, commits, and tests all play—hooray!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately and concisely summarizes the main changes: removing unused dependencies and bundling react-icons across the monorepo.
Description check ✅ Passed The PR description covers Summary, Rationale, Changes, Impact, and Testing, providing comprehensive details about dependency removals and react-icons bundling across 11 packages.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/trim-unnecessary-dependencies

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/core/src/comments/threadstore/yjs/YjsThreadStore.test.ts`:
- Around line 7-12: The test file sets a module-level spy via vi.spyOn(crypto,
"randomUUID") but never restores it, leaving the mocked implementation active;
change the spy creation to capture the spy object (e.g., const randomUUIDSpy =
vi.spyOn(crypto, "randomUUID").mockImplementation(...)) and restore it in a test
teardown (call randomUUIDSpy.mockRestore() inside an afterAll or afterEach hook
and import the hook from the test framework), while keeping the existing
mockUuidCounter and originalRandomUUID references intact so the mock still
returns sequential IDs.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: e53fb7ec-82f8-4e91-9233-5b67a05d021a

📥 Commits

Reviewing files that changed from the base of the PR and between d609476 and aabbd3a.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (13)
  • packages/core/package.json
  • packages/core/src/comments/threadstore/yjs/YjsThreadStore.test.ts
  • packages/core/src/comments/threadstore/yjs/YjsThreadStore.ts
  • packages/core/src/extensions/Placeholder/Placeholder.ts
  • packages/core/src/extensions/tiptap-extensions/UniqueID/UniqueID.ts
  • packages/react/package.json
  • packages/react/src/components/FormattingToolbar/DefaultButtons/BasicTextStyleButton.tsx
  • packages/react/src/components/FormattingToolbar/DefaultButtons/TextAlignButton.tsx
  • packages/react/src/components/FormattingToolbar/DefaultSelects/BlockTypeSelect.tsx
  • packages/react/src/components/SuggestionMenu/getDefaultReactSlashMenuItems.tsx
  • packages/react/src/icons.ts
  • packages/react/src/index.ts
  • packages/react/vite.config.ts
💤 Files with no reviewable changes (1)
  • packages/core/package.json

Comment thread packages/core/src/comments/threadstore/yjs/YjsThreadStore.test.ts
- code-block: move @blocknote/core and @shikijs/types to devDeps (type-only imports)
- mantine: bundle react-icons into build output
- shadcn: remove unused autoprefixer
- xl-ai: remove unused @blocknote/mantine, @tiptap/core, react-dom; bundle react-icons
- server-util: remove unused @tiptap/core; move yjs/y-prosemirror/y-protocols to devDeps
- xl-email-exporter: remove unused @blocknote/react, buffer, react, react-dom; move react-email to devDeps
- xl-multi-column: remove unused prosemirror-tables, prosemirror-transform; bundle react-icons
- xl-odt-exporter: remove unused buffer
- xl-pdf-exporter: remove unused @blocknote/react, buffer, docx
- Fix IconType to use function signature matching react-icons' original type
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 27, 2026

Open in StackBlitz

@blocknote/ariakit

npm i https://pkg.pr.new/@blocknote/ariakit@2796

@blocknote/code-block

npm i https://pkg.pr.new/@blocknote/code-block@2796

@blocknote/core

npm i https://pkg.pr.new/@blocknote/core@2796

@blocknote/mantine

npm i https://pkg.pr.new/@blocknote/mantine@2796

@blocknote/react

npm i https://pkg.pr.new/@blocknote/react@2796

@blocknote/server-util

npm i https://pkg.pr.new/@blocknote/server-util@2796

@blocknote/shadcn

npm i https://pkg.pr.new/@blocknote/shadcn@2796

@blocknote/xl-ai

npm i https://pkg.pr.new/@blocknote/xl-ai@2796

@blocknote/xl-docx-exporter

npm i https://pkg.pr.new/@blocknote/xl-docx-exporter@2796

@blocknote/xl-email-exporter

npm i https://pkg.pr.new/@blocknote/xl-email-exporter@2796

@blocknote/xl-multi-column

npm i https://pkg.pr.new/@blocknote/xl-multi-column@2796

@blocknote/xl-odt-exporter

npm i https://pkg.pr.new/@blocknote/xl-odt-exporter@2796

@blocknote/xl-pdf-exporter

npm i https://pkg.pr.new/@blocknote/xl-pdf-exporter@2796

commit: 1def215

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/server-util/package.json`:
- Around line 66-68: The package manifest currently lists "yjs" only in
devDependencies while ServerBlockNoteEditor.ts imports types from "yjs" and
exposes Y.Doc/Y.XmlFragment in public APIs (see yXmlFragmentToBlocks,
blocksToYXmlFragment, yDocToBlocks, blocksToYDoc); move "yjs" from
devDependencies into dependencies in package.json so consuming projects can
resolve those public TypeScript types at runtime/compile time.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 387b2a76-533f-4a8d-9b91-e3063044892d

📥 Commits

Reviewing files that changed from the base of the PR and between aabbd3a and 628d5e2.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (13)
  • packages/code-block/package.json
  • packages/mantine/package.json
  • packages/mantine/vite.config.ts
  • packages/react/src/icons.ts
  • packages/server-util/package.json
  • packages/shadcn/package.json
  • packages/xl-ai/package.json
  • packages/xl-ai/vite.config.ts
  • packages/xl-email-exporter/package.json
  • packages/xl-multi-column/package.json
  • packages/xl-multi-column/vite.config.ts
  • packages/xl-odt-exporter/package.json
  • packages/xl-pdf-exporter/package.json
💤 Files with no reviewable changes (2)
  • packages/xl-odt-exporter/package.json
  • packages/shadcn/package.json
✅ Files skipped from review due to trivial changes (1)
  • packages/xl-pdf-exporter/package.json
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/react/src/icons.ts

Comment thread packages/server-util/package.json Outdated
Comment thread packages/code-block/package.json Outdated
Comment on lines +58 to +59
"@blocknote/core": "0.51.3",
"@shikijs/types": "^4",
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This should be a optional meta dep no?

Comment thread packages/code-block/package.json Outdated
"@shikijs/themes": "^4"
},
"devDependencies": {
"@blocknote/core": "0.51.3",
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is a peer dep no?

@@ -1,4 +1,4 @@
import { uuidv4 } from "lib0/random";

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

run the lint this line should not be here

Copy link
Copy Markdown
Contributor Author

@nperez0111 nperez0111 left a comment

Choose a reason for hiding this comment

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

see other comments

- Remove leading blank line in YjsThreadStore.ts (nperez0111)
- Restore crypto.randomUUID spy in afterAll in test (coderabbitai)
- Move @blocknote/core out of devDeps in code-block (already peerDep)
- Move @shikijs/types to optionalDependencies in code-block (nperez0111)
- Move yjs back to dependencies in server-util (public API types)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant