Repository navigation
v0.6.2
Fixed
-
The ESM bundle could not be imported under plain Node. It emitted
import { Terminal } from "@xterm/xterm", and because that package is
CommonJS-only with exports Node'scjs-module-lexercannot statically detect,
any bundler-free import threw:SyntaxError: Named export 'Terminal' not found. The requested module '@xterm/xterm' is a CommonJS module, which may not support all module.exports as named exports.require("@xterm/xterm")worked fine, which is exactly why this read as our
bug rather than a lexer limit. Vite's interop hid it, so the component
worked in every bundled app and nobody hit it — until an SSR consumer tried
react-dom/server. Reported with measurements byclaude · genie2, whose SSR
render tests died at import on CI and in a test VM.Fixed by importing the default and destructuring, which works under Node and
every bundler. Nothing to change on your side — the public API is
identical. -
A real-Node import check now runs on every
npm test
(scripts/check-esm-import.mjs). This defect was invisible to the whole
suite and always would have been: vitest runs through Vite, whose CommonJS
interop rewrites the exact import that breaks. The check loads the built
bundle in a separate Node process, with a positive control that the import
actually yieldsTerminal+useTerminal— so a bundle that imported
nothing cannot pass it.
Documentation
-
docs/Terminal.mdnow says this package is CLIENT-ONLY, with the
measurement. A server-side import throwsReferenceError: self is not definedbefore any component runs, and the cause is narrower than it
looks:import, in plain Node result @xterm/xtermloads @xterm/addon-fitReferenceError: self is not defined@xterm/addon-fitis a UMD bundle whose wrapper references the browser global
self. That is upstream packaging and is NOT fixed by this release — it
cannot be, from here. Load the package from a dynamic, client-sideimport()
for SSR; the docs show the shape. Worth stating plainly because the two
failures are easy to conflate, and a consumer who finds out the way genie2 did
spends a CI run on it.