Skip to content

Use ESM for our executables (tsc, tsserver, typingsInstaller) #51440

Open
@jakebailey

Description

@jakebailey

Our libraries are all UMD-ish, because they can be used in Node or in the browser. I didn't change this for the module transform.

However, most of our executables are CJS, as they are only intended to be run within Node. This includes tsc, typingsInstaller, and watchGuard. An exception is tsserver, which contains web code for vscode.dev.

tsc and typingsInstaller both share a lot of code; if they only run on Node anyway, we could potentially raise our minimum Node version to node 12, and ship them as ESM via esbuild's split ESM bundling. If we get vscode.dev off of tsserver (and onto tsserverlibrary), then all three can share code.

In my testing, this reduces our package size by an additional 7 MB, which is a great win.

See also #27891, #32949.

Metadata

Metadata

Assignees

Labels

InfrastructureIssue relates to TypeScript team infrastructure

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions