Skip to content

electron: bundle node-pty properly#21148

Merged
Brendonovich merged 1 commit intobrendan/electron-remove-clifrom
brendan/electron-pty
Apr 6, 2026
Merged

electron: bundle node-pty properly#21148
Brendonovich merged 1 commit intobrendan/electron-remove-clifrom
brendan/electron-pty

Conversation

@Brendonovich
Copy link
Copy Markdown
Member

Configures @lydell/node-pty as an external package and ensures that Electron only bundles the specific package needed for each platform

Comment on lines +27 to +33
{
name: "opencode:node-pty-narrower",
enforce: "pre",
resolveId(s) {
if (s === "@lydell/node-pty") return nodePtyPkg
},
},
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets us avoid the dynamic package requires that @lydell/node-pty does. The platform-specific packages thankfully export the same APIs as the top-level package, so we can just swap any imports and have the same functionality by statically importing just the package we need.

},
"devDependencies": {
"@actions/artifact": "4.0.0",
"@lydell/node-pty": "catalog:",
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Being a dev dependency means that electron packager doesn't include it + all the platform-specific packages in the final bundle

"@lydell/node-pty-linux-arm64": "1.2.0-beta.10",
"@lydell/node-pty-linux-x64": "1.2.0-beta.10",
"@lydell/node-pty-win32-arm64": "1.2.0-beta.10",
"@lydell/node-pty-win32-x64": "1.2.0-beta.10"
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bun will only install the necessary package from this list, not all of them. We'll need to keep this in sync with the other node-pty versions - might make a script.

@Brendonovich Brendonovich merged commit a8abd82 into brendan/electron-remove-cli Apr 6, 2026
9 of 12 checks passed
@Brendonovich Brendonovich deleted the brendan/electron-pty branch April 6, 2026 03:28
Brendonovich added a commit that referenced this pull request Apr 6, 2026
Brendonovich added a commit that referenced this pull request Apr 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant