Skip to content

Conversation

@weilinzung
Copy link

Changes Overview

Fixed a runtime error when initializing CodeBlockLowlight by switching the CodeBlock import to a named export. This prevents extend is not a function errors caused by ESM/CJS interop issues.

Implementation Approach

Replaced the default import of CodeBlock from @tiptap/extension-code-block with a named import to ensure the actual extension instance is used. No behavioral changes were introduced beyond the fix.

Testing Done

  • Verified editor initializes without runtime errors
  • Confirmed code blocks render correctly
  • Confirmed syntax highlighting via CodeBlockLowlight works as expected

Verification Steps

  1. Start the editor
  2. Insert a code block
  3. Verify syntax highlighting renders
  4. Confirm no runtime errors in the console

Additional Notes

This issue occurs in certain ESM/CJS environments (e.g. Jest, SSR, or specific bundler configurations) where default imports may resolve to a module wrapper instead of the extension itself.

Checklist

  • I have created a changeset for this PR if necessary.
  • My changes do not break the library.
  • I have added tests where applicable.
  • I have followed the project guidelines.
  • I have fixed any lint issues.

Related Issues

Fixes #6703
Fixes #7092

CodeBlockLowlight expects CodeBlock to expose `.extend()`, but default
imports can resolve to a module wrapper in some ESM/CJS environments,
causing `extend is not a function` at runtime.

Switching to a named import ensures the actual CodeBlock extension
is used and fixes the crash.
Copilot AI review requested due to automatic review settings December 27, 2025 00:51
@changeset-bot
Copy link

changeset-bot bot commented Dec 27, 2025

🦋 Changeset detected

Latest commit: 5ce3006

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

This PR includes changesets to release 71 packages
Name Type
@tiptap/extension-code-block-lowlight Patch
@tiptap/core Patch
@tiptap/extension-blockquote Patch
@tiptap/extension-bold Patch
@tiptap/extension-bubble-menu Patch
@tiptap/extension-bullet-list Patch
@tiptap/extension-code-block Patch
@tiptap/extension-code Patch
@tiptap/extension-collaboration-caret Patch
@tiptap/extension-collaboration Patch
@tiptap/extension-color Patch
@tiptap/extension-details Patch
@tiptap/extension-document Patch
@tiptap/extension-drag-handle-react Patch
@tiptap/extension-drag-handle-vue-2 Patch
@tiptap/extension-drag-handle-vue-3 Patch
@tiptap/extension-drag-handle Patch
@tiptap/extension-emoji Patch
@tiptap/extension-file-handler Patch
@tiptap/extension-floating-menu Patch
@tiptap/extension-font-family Patch
@tiptap/extension-hard-break Patch
@tiptap/extension-heading Patch
@tiptap/extension-highlight Patch
@tiptap/extension-horizontal-rule Patch
@tiptap/extension-image Patch
@tiptap/extension-invisible-characters Patch
@tiptap/extension-italic Patch
@tiptap/extension-link Patch
@tiptap/extension-list Patch
@tiptap/extension-mathematics Patch
@tiptap/extension-mention Patch
@tiptap/extension-node-range Patch
@tiptap/extension-ordered-list Patch
@tiptap/extension-paragraph Patch
@tiptap/extension-strike Patch
@tiptap/extension-subscript Patch
@tiptap/extension-superscript Patch
@tiptap/extension-table-of-contents Patch
@tiptap/extension-table Patch
@tiptap/extension-text-align Patch
@tiptap/extension-text-style Patch
@tiptap/extension-text Patch
@tiptap/extension-twitch Patch
@tiptap/extension-typography Patch
@tiptap/extension-underline Patch
@tiptap/extension-unique-id Patch
@tiptap/extension-youtube Patch
@tiptap/extensions Patch
@tiptap/html Patch
@tiptap/markdown Patch
@tiptap/pm Patch
@tiptap/react Patch
@tiptap/starter-kit Patch
@tiptap/static-renderer Patch
@tiptap/suggestion Patch
@tiptap/vue-2 Patch
@tiptap/vue-3 Patch
@tiptap/extension-character-count Patch
@tiptap/extension-dropcursor Patch
@tiptap/extension-focus Patch
@tiptap/extension-gapcursor Patch
@tiptap/extension-history Patch
@tiptap/extension-list-item Patch
@tiptap/extension-list-keymap Patch
@tiptap/extension-placeholder Patch
@tiptap/extension-table-cell Patch
@tiptap/extension-table-header Patch
@tiptap/extension-table-row Patch
@tiptap/extension-task-item Patch
@tiptap/extension-task-list 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

@netlify
Copy link

netlify bot commented Dec 27, 2025

Deploy Preview for tiptap-embed ready!

Name Link
🔨 Latest commit 5ce3006
🔍 Latest deploy log https://app.netlify.com/projects/tiptap-embed/deploys/694f2f31d4f82e00087f0400
😎 Deploy Preview https://deploy-preview-7370--tiptap-embed.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes a runtime error in CodeBlockLowlight where calling .extend() would fail in certain ESM/CJS environments. The fix changes the import statement for CodeBlock from a default import to a named import, aligning with the pattern used in other packages like starter-kit.

Key Changes

  • Changed CodeBlock import from default to named export to ensure proper extension behavior across different module systems

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

CodeBlockLowlight extension crashes in Jest Uncaught TypeError: import_extension_code_block.default.extend is not a function

1 participant