Uh oh!
There was an error while loading. Please reload this page.
electron: bundle node-pty properly - #21148
Conversation
| { | ||
| name: "opencode:node-pty-narrower", | ||
| enforce: "pre", | ||
| resolveId(s) { | ||
| if (s === "@lydell/node-pty") return nodePtyPkg | ||
| }, | ||
| }, |
There was a problem hiding this comment.
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:", |
There was a problem hiding this comment.
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" |
There was a problem hiding this comment.
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.
a8abd82
into
brendan/electron-remove-cliUh oh!
There was an error while loading. Please reload this page.
Configures
@lydell/node-ptyas an external package and ensures that Electron only bundles the specific package needed for each platform