fix: add exports field to package.json for CSS subpath resolution#5795
Open
renevanpelt wants to merge 1 commit intoxtermjs:masterfrom
Open
fix: add exports field to package.json for CSS subpath resolution#5795renevanpelt wants to merge 1 commit intoxtermjs:masterfrom
renevanpelt wants to merge 1 commit intoxtermjs:masterfrom
Conversation
Without an exports field, strict module resolution environments (e.g. pnpm workspaces with moduleResolution: bundler or node16) cannot resolve subpath imports such as `import '@xterm/xterm/css/xterm.css'`. Add an exports map exposing the main entry point and the CSS file.
scutuatua-crypto
approved these changes
Apr 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The published
@xterm/xtermpackage has noexportsfield in itspackage.json. In strict module resolution environments — such as pnpm workspaces withmoduleResolution: bundlerornode16— subpath imports like:fail with an error along the lines of "Package subpath './css/xterm.css' is not defined by 'exports'".
Fix
Add an
exportsmap that exposes:"."— the existing main entry (./lib/xterm.js) for bothrequireandimport"./css/xterm.css"— the stylesheet, so CSS subpath imports resolve correctlyNo source files are changed. All existing unit tests (2242) continue to pass.