The @xterm/headless package on npm declares "module": "lib/xterm.mjs", but no lib/ directory exists in the published tarball — the ESM build actually ships at lib-headless/xterm-headless.mjs. The exports map is missing entirely. Verified on 6.0.0 (latest) and 6.1.0-beta.288/6.1.0-beta.289:
$ npm view @xterm/headless@6.0.0 module main
module = 'lib/xterm.mjs'
main = 'lib-headless/xterm-headless.js'
$ npm pack @xterm/headless@6.1.0-beta.289 && tar -tzf xterm-headless-*.tgz | grep '^package/lib/'
(no matches — lib/ does not exist)
The repo's committed headless/package.json has the correct module and exports values, but bin/package_headless.js regenerates that file at publish time by spreading the main package's package.json and only overriding name/description/main/types — so the main package's module (lib/xterm.mjs, valid only for @xterm/xterm) leaks into every @xterm/headless release and the committed exports map is dropped.
Impact: ESM-first resolvers that honor module try a nonexistent file. Bun silently falls back to main (CJS) so it happens to work there; stricter bundler configs can hard-fail, and nothing gets the intended exports resolution.
Fix is a few lines in bin/package_headless.js (override module and exports as well, matching the committed manifest) — PR incoming.
The
@xterm/headlesspackage on npm declares"module": "lib/xterm.mjs", but nolib/directory exists in the published tarball — the ESM build actually ships atlib-headless/xterm-headless.mjs. Theexportsmap is missing entirely. Verified on6.0.0(latest) and6.1.0-beta.288/6.1.0-beta.289:The repo's committed headless/package.json has the correct
moduleandexportsvalues, but bin/package_headless.js regenerates that file at publish time by spreading the main package's package.json and only overridingname/description/main/types— so the main package'smodule(lib/xterm.mjs, valid only for@xterm/xterm) leaks into every@xterm/headlessrelease and the committedexportsmap is dropped.Impact: ESM-first resolvers that honor
moduletry a nonexistent file. Bun silently falls back tomain(CJS) so it happens to work there; stricter bundler configs can hard-fail, and nothing gets the intendedexportsresolution.Fix is a few lines in
bin/package_headless.js(overridemoduleandexportsas well, matching the committed manifest) — PR incoming.