TS6 & TSDown#48
Open
Pearce-Ropion wants to merge 4 commits intomainfrom
Open
Conversation
ryan-sigma
reviewed
May 8, 2026
| }, | ||
| }, | ||
| outExtensions: ({ format }) => { | ||
| if (format === 'es') return { js: '.js', dts: '.d.ts' }; |
Contributor
There was a problem hiding this comment.
is this to avoid us having .mjs as an extension for some reason?
Collaborator
Author
There was a problem hiding this comment.
Might not be necessary. I was having trouble getting attw to pass. I'll give it another go
Collaborator
Author
There was a problem hiding this comment.
Claude said this...
outExtensions is necessary because of "type": "module" in [package.json:7](vscode-webview://0mk05v0rhfbp3n674ov47ss8o9rrtckoum75g9addagbqjl3f4o9/package.json#L7).
With that field set, Node treats every .js file as ESM. So the CJS build can't use .js — it has to be .cjs, otherwise Node would try to load it as ESM at runtime and crash on require/module.exports.
The matching .d.cts for the CJS types is required for TypeScript's node16/nodenext module resolution. When a consumer does require('@sigmacomputing/plugin'), TS only picks up the CJS declaration if its extension lines up with the JS file (.cjs → .d.cts). The exports map in [package.json:11-22](vscode-webview://0mk05v0rhfbp3n674ov47ss8o9rrtckoum75g9addagbqjl3f4o9/package.json#L11-L22) is wired up the same way:
import → dist/esm/index.js + dist/esm/index.d.ts
require → dist/cjs/index.cjs + dist/cjs/index.d.cts
Without the override, tsdown would emit .js/.d.ts for both formats and the CJS half of the dual package would be broken — attw and publint (both enabled at [tsdown.config.ts:36-37](vscode-webview://0mk05v0rhfbp3n674ov47ss8o9rrtckoum75g9addagbqjl3f4o9/tsdown.config.ts#L36-L37)) would also fail.
But I tried removing it and it had no effect... so removing
ryan-sigma
previously approved these changes
May 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.
Various changes and fixes to the build system
cjsandesmbuildspublintunusedandattwplugins to ensure published package is correctyarn typesbecause the build system no longer runs type check__VERSION__injection instead of importing package.json in runtime