Skip to content

Fix comment widget chunk cache invalidation - #251

Merged
ruibaby merged 1 commit into
mainfrom
fix/comment-widget-chunk-cache
Sep 17, 2026
Merged

ruibaby merged 1 commit into
mainfrom
fix/comment-widget-chunk-cache

Conversation

@ruibaby

@ruibaby ruibaby commented Sep 17, 2026

Copy link
Copy Markdown
Member

Summary

Fix comment editor initialization failures caused by cached chunks from different builds being loaded together.

With modern-module output, changing a shared module can change an importing chunk's contents without changing its contenthash filename. This was reproduced locally and observed in production, where mixed chunks triggered RangeError: Adding different instances of a keyed plugin (plugin$).

Use fullhash for chunk filenames while preserving the small comment-widget.js re-export entry. Upgrade Rslib to 1.0.1 and migrate autoExternal to output.autoExternal.

All JavaScript chunk URLs now change together when the build hash changes. This trades cross-build cache reuse for consistent chunk references.

Reproduction and validation

  • Build the regression fixture twice with different shared-module values. Before the fix, an importing chunk retains its filename despite changed contents.
  • The regression test now passes and verifies that the entry remains small.
  • Production build passed: pnpm -C packages/widget build.
  • A two-build comparison of the full widget found no same-URL content conflicts.
  • Loaded the final production assets in Chrome through a local HTTP server: editor initialization succeeded with 76 unique plugin keys, bold formatting worked, and no console errors were recorded.

Production CDN behavior after deployment, comment submission, and uploads have not been tested.

Deployment

Refresh existing CDN caches under /plugins/PluginCommentWidget/assets/static/, including compressed variants, after deployment.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 17, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-17T09:12:50.613673Z dc8bb4b PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: dc8bb4bed1

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/widget/tests/content-hash.test.mjs
@ruibaby
ruibaby merged commit a900785 into main Sep 17, 2026
2 checks passed
@ruibaby
ruibaby deleted the fix/comment-widget-chunk-cache branch September 17, 2026 10:13
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