Skip to content

noVNC as real ESM, one module shape for every bundler - #271

Merged
czpython merged 1 commit into
mainfrom
commonzenpython/novnc-esm
Aug 17, 2026
Merged

noVNC as real ESM, one module shape for every bundler#271
czpython merged 1 commit into
mainfrom
commonzenpython/novnc-esm

Conversation

@czpython

Copy link
Copy Markdown
Owner

@novnc/novnc 1.5.0 ships only Babel CommonJS, and the bundlers disagree about what its default import means: dev and vitest unwrap exports.default to the class, while the production build (rolldown) follows Node's CJS-interop semantics and hands back the whole exports object. The login window page therefore worked everywhere except the deployed bundle, where new RFB(...) compiled to new zi.default(...) with zi.default being the exports object — the live error: zi.default is not a constructor.

1.7.0 is type: module with an exports map pointing the bare specifier at core/rfb.js. Real ESM ends the interop question: the bare import RFB from '@novnc/novnc' resolves the class identically in dev, vitest, and the build. The page's use of RFB (constructor, scaleViewport, resizeSession, connect/disconnect events) is unchanged across 1.5→1.7.

Verified in the built bundle: the construction site is now a direct new <class>(...) with no .default indirection, and the class resolves to RFB's real constructor. 117 frontend tests pass; lint and tsc clean.

Deploy: the fix rides the next druks image build — redeploy after merge.

@novnc/novnc 1.5.0 ships only Babel CommonJS, and the bundlers disagree
about what its default import means: dev and vitest unwrap exports.default
to the class, while the production build follows Node semantics and hands
back the whole exports object — so the deployed login window died at
new RFB() with 'zi.default is not a constructor'.

1.7.0 is type: module with an exports map pointing the bare specifier at
core/rfb.js. Real ESM, no interop anywhere: the bare import resolves the
class identically in dev, vitest, and the build.
@czpython
czpython enabled auto-merge (squash) August 17, 2026 11:09
@czpython
czpython merged commit 065d403 into main Aug 17, 2026
1 check passed
@czpython
czpython deleted the commonzenpython/novnc-esm branch August 17, 2026 11:09
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