From a1fced10bf37a339709243a9576b3fdcae832fb8 Mon Sep 17 00:00:00 2001 From: Craig Riecke Date: Sat, 6 Jan 2024 15:45:48 -0500 Subject: [PATCH] fix vscode-graphql-execution esbuild.js (#3480) * Update esbuild.js A possibly naive way to make vscode extension work after esbuild upgrade. * Update esbuild.js Turns out I was quite naive about just excluding graphql-config. The extension worked under the Test Runner, but not when bundled and installed. This change actually does work, even when the plugin is bundled and installed separately. It uses the technique outlined in https://github.com/evanw/esbuild/issues/2441 * add changeset --------- Co-authored-by: Rikki Schulte --- .changeset/smooth-clocks-try.md | 6 ++++++ packages/vscode-graphql-execution/esbuild.js | 4 ++++ 2 files changed, 10 insertions(+) create mode 100644 .changeset/smooth-clocks-try.md diff --git a/.changeset/smooth-clocks-try.md b/.changeset/smooth-clocks-try.md new file mode 100644 index 00000000000..1209feaf410 --- /dev/null +++ b/.changeset/smooth-clocks-try.md @@ -0,0 +1,6 @@ +--- +"vscode-graphql-execution": patch +"vscode-graphql": patch +--- + +Fix execution extension esbuild bundling diff --git a/packages/vscode-graphql-execution/esbuild.js b/packages/vscode-graphql-execution/esbuild.js index 0b1d1ab9214..783fa706c16 100644 --- a/packages/vscode-graphql-execution/esbuild.js +++ b/packages/vscode-graphql-execution/esbuild.js @@ -49,6 +49,10 @@ build({ ], format: 'cjs', sourcemap: true, + define: { 'import.meta.url': '_importMetaUrl' }, + banner: { + js: "const _importMetaUrl=require('url').pathToFileURL(__filename)", + }, }) .then(({ errors, warnings }) => { if (warnings.length) {