-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
fix(tiptap): use named CodeBlock import to avoid runtime extend error for CodeBlockLowlight extension
#7370
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
fix(tiptap): use named CodeBlock import to avoid runtime extend error for CodeBlockLowlight extension
#7370
Conversation
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.
🦋 Changeset detectedLatest commit: 5ce3006 The changes in this PR will be included in the next version bump. This PR includes changesets to release 71 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 |
✅ Deploy Preview for tiptap-embed ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this 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
CodeBlockimport 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.
There was a problem hiding this 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.
Changes Overview
Fixed a runtime error when initializing
CodeBlockLowlightby switching theCodeBlockimport to a named export. This preventsextend is not a functionerrors caused by ESM/CJS interop issues.Implementation Approach
Replaced the default import of
CodeBlockfrom@tiptap/extension-code-blockwith a named import to ensure the actual extension instance is used. No behavioral changes were introduced beyond the fix.Testing Done
CodeBlockLowlightworks as expectedVerification Steps
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
Related Issues
Fixes #6703
Fixes #7092