Skip to content

fix(build): stop lazy chunks from loading the entries a second time - #1443

Open
hweihwang wants to merge 1 commit into
mainfrom
fix/entries-loaded-twice
Open

hweihwang wants to merge 1 commit into
mainfrom
fix/entries-loaded-twice

Conversation

@hweihwang

Copy link
Copy Markdown
Contributor

Part of #1439

Nextcloud loads whiteboard-main.mjs?v=…, but lazy chunks imported shared code from ./whiteboard-main.mjs without the query. The browser loaded that as a second module, so the main script ran twice. On the recording page this mounted two whiteboards, and the recording bot sometimes followed the one that wasn't on screen: the recording failed or showed an empty board. whiteboard-viewer.mjs had the same problem on Nextcloud 36.

With preserveEntrySignatures: 'strict', Rollup moves the shared code out of the entries, so no chunk imports an entry anymore.

Tested with a bundle test that fails on main, where 50 chunks import an entry. The viewer init script still loads no React. On Nextcloud 31 the recording page and Files load whiteboard-main.mjs once, and boards open in the viewer.

AI

  • Prepared with AI assistance.

Nextcloud loads the entries with a ?v= query, while chunks import each
other by plain relative paths. Rollup kept code shared with lazy chunks
inside the entry chunks, so loading such a chunk fetched the entry again
under a second URL and ran it twice. On the recording page this mounted
two whiteboards, and the recording bot could follow one that was not
shown, so recordings failed or stayed empty.

Strict entry signatures make Rollup move that shared code out of the
entries, which leaves them as facades that no chunk imports.

Refs #1439

Assisted-by: ClaudeCode:claude-opus-5-5
Signed-off-by: Hoang Pham <hoangmaths96@gmail.com>
@hweihwang
hweihwang requested a review from grnd-alt October 28, 2026 09:07
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