fix: mark prism-extend as side-effectful to fix CJS language registration#5148
Merged
traefiker merged 1 commit intotraefik:masterfrom Apr 30, 2026
Merged
fix: mark prism-extend as side-effectful to fix CJS language registration#5148traefiker merged 1 commit intotraefik:masterfrom
traefiker merged 1 commit intotraefik:masterfrom
Conversation
f7ad391 to
5e50225
Compare
gndz07
approved these changes
Apr 30, 2026
|
🎉 This PR is included in version 12.3.3 🎉 The release is available on: Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Additional Prism languages registered in
prism-extend.tsworked locally and in Storybook but were silently dropped when hub-ui was built via Docker CI.Root cause
package.jsonhad"sideEffects": false, which tells bundlers they can safely tree-shake any module that only re-exports values from externals. Rolldown exploited this when generating the CJS build: sinceprism-extend.tsre-exportsPrismfromprism-react-renderer(an external dependency), it inlined the import directly and never generatedprism-extend.cjs, losing all the language registration side effects in the process.The ESM build was unaffected because ESM preserves module identity more strictly. Local development was also unaffected because webpack skips tree-shaking in dev mode.
The combination that triggered the bug: CJS resolution (Next.js production build) + tree-shaking enabled (webpack production mode) +
sideEffects: false(told rolldown the module was pure).How to test
next build(or trigger a Docker CI build) this exercises the CJS path with tree-shaking enabledCodeBlockwith one of the previously broken languages (e.g.hcl,toml,docker,bash) and verify syntax highlighting is applied correctlyGood PR checkboxes
Good Review checkboxes
ℹ️ Copy the snippet and paste in the review field to fill it