From 37f0dc78d81d977c035d5aaee532dc79ee51afc7 Mon Sep 17 00:00:00 2001 From: owenpearson Date: Wed, 27 Mar 2024 12:39:18 +0000 Subject: [PATCH 1/2] build(node): mark ws as external module --- grunt/esbuild/build.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/grunt/esbuild/build.js b/grunt/esbuild/build.js index 9be115264..31148be73 100644 --- a/grunt/esbuild/build.js +++ b/grunt/esbuild/build.js @@ -43,6 +43,15 @@ const nodeConfig = { platform: 'node', entryPoints: ['src/platform/nodejs/index.ts'], outfile: 'build/ably-node.js', + /** + * externals are not bundled into the esbuild output, instead they are left + * as commonjs imports. This means that the version installed via package.json + * dependencies is used rather than being pinned to whatever version we built + * the package release with. This is especially important in the case of 'ws' + * where the bun runtime has its own 'ws' module, and the npm 'ws' module + * doesn't work at all. + */ + external: ['ws'], }; module.exports = { From 791929bdf16fbc93faf15d4d531d0bc01db43dca Mon Sep 17 00:00:00 2001 From: owenpearson Date: Wed, 27 Mar 2024 12:52:41 +0000 Subject: [PATCH 2/2] build(node): mark got as external module --- grunt/esbuild/build.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/grunt/esbuild/build.js b/grunt/esbuild/build.js index 31148be73..16018560d 100644 --- a/grunt/esbuild/build.js +++ b/grunt/esbuild/build.js @@ -51,7 +51,7 @@ const nodeConfig = { * where the bun runtime has its own 'ws' module, and the npm 'ws' module * doesn't work at all. */ - external: ['ws'], + external: ['ws', 'got'], }; module.exports = {