Skip to content

Published @xterm/headless has a broken module field and no exports map #6052

Description

@yyq1025

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions