Skip to content

fix: resolve build import and chunk-size warnings - #146

Merged
mrboxs merged 2 commits into
mainfrom
t3/fix-ineffective-dynamic-imports
Nov 10, 2026
Merged

mrboxs merged 2 commits into
mainfrom
t3/fix-ineffective-dynamic-imports

Conversation

@mrboxs

@mrboxs mrboxs commented Nov 10, 2026 •

Copy link
Copy Markdown
Collaborator

Production builds reported ineffective dynamic imports for auth and Shiki themes, plus oversized client chunks. Use consistent imports and split React, editor, and language dependencies while retaining the default 500 kB warning threshold.

Remove C++ highlighting, including Ruby's transitive C++ grammar. Load the pinned upstream Ruby grammar with its remaining embedded languages so Ruby highlighting still works and existing C++ code blocks remain readable as plain text.

Validation:

  • Web production build passes without the reported import or chunk-size warnings.
  • 42 targeted tests pass across Markdown preparation and BlockNote integration, including C++ fallback and Ruby/HTML highlighting.
  • Formatting, lint, and web TypeScript checks pass.
  • Generated client assets contain no C++ grammar or JavaScript chunks above 500 kB.

Summary by CodeRabbit

  • New Features
    • Ruby code blocks now support syntax highlighting, including embedded languages such as HTML, SQL, JavaScript, and CSS.
  • Bug Fixes
    • C++ code blocks remain readable when syntax highlighting is unavailable.
    • Ruby highlighting preserves code text and applies distinct colors to Ruby and embedded HTML.

- Apply text styling when each custom theme is imported
- Split editor and Shiki language chunks and tune chunk warnings
- Load API auth statically while keeping the database dynamic
- Use a Ruby grammar without its embedded C++ dependency
- Keep C++ code blocks readable as plain text
@coderabbitai

coderabbitai Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The web app adds custom Ruby language registrations, removes C++ highlighting registrations, and changes built-in theme loading. The client build adds dependency split groups. The API context changes how it imports auth and db.

Changes

Shiki Language and Theme Registrations

Layer / File(s) Summary
Ruby and C++ language registrations
apps/web/package.json, apps/web/src/utils/shiki-ruby.ts, apps/web/src/utils/shiki.bundle.ts, apps/web/tests/public-content-prepare.test.ts
The web app adds tm-grammars and a Ruby registration with embedded languages. The Shiki bundle removes C++ registrations and loads Ruby through the local registration. Tests check C++ code-block behavior and Ruby and embedded HTML highlighting.
Asynchronous built-in theme loading
apps/web/src/utils/shiki.bundle.ts
The One Dark Pro and One Light registrations dynamically import their themes and apply withCodeBlockBoldTokens.

Client Build Splitting

Layer / File(s) Summary
Client dependency split groups
apps/web/vite.config.ts
The client build config adds split groups for React, editor, and Shiki language modules. The editor and Shiki groups use entry-aware splitting and a 500,000-byte maximum size.

API Context Imports

Layer / File(s) Summary
API context module loading
packages/api/src/context.ts
createORPCContext statically imports auth and dynamically imports db, replacing the previous concurrent dynamic imports.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix

Merge Risk: Minimal · up to f6b20

No concrete merge-blocking issue is established. Merge after the normal build and test checks.

Pre-merge checks: Passed 5

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly summarizes the main changes: resolving build import and chunk-size warnings.
Docstring Coverage Passed No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
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.
Full details: Docstring Coverage

Explanation

No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 0 functions across 5 files. (1 skipped: 1 unsupported.)

Finishing Touches

Generate docstrings

  • Commit to this branch
  • Create a new PR
Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 47cce19 and f6b2032.

Files ignored due to path filters: 1

  • bun.lock is excluded by !**/*.lock
Files selected for processing: 6

  • apps/web/package.json
  • apps/web/src/utils/shiki-ruby.ts
  • apps/web/src/utils/shiki.bundle.ts
  • apps/web/tests/public-content-prepare.test.ts
  • apps/web/vite.config.ts
  • packages/api/src/context.ts

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

@github-actions

Copy link
Copy Markdown

React Doctor found 1 new issue in 1 file · 1 warning · score 87 / 100 (Great) · 0 fixed · vs main

1 warning

src/context.ts

  • ⚠️ L8 Sequential independent awaits server-sequential-independent-await

Reviewed by React Doctor for commit f6b2032. See inline comments for fixes.

])
const { db } = await import('@altstack/db')

const session = await auth.api.getSession({ headers })

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

React Doctor · react-doctor/server-sequential-independent-await (warning)

This awaited initializer does not read the previous result. If the operations are independent asynchronous work, they may overlap; await syntax alone does not establish a speedup.

Fix → Consider Promise.all([...]) only for independent asynchronous work. Shared queues or synchronous work may not benefit. Preserve resource limits, transaction ordering, and failure/cancellation semantics.

Docs

@mrboxs
mrboxs merged commit 49c5ef5 into main Nov 10, 2026
3 checks passed
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