From 1d1a04d8c97a80bf3714482aa8e642dbef1159fd Mon Sep 17 00:00:00 2001 From: Rahul Sethi <5822355+RamIdeas@users.noreply.github.com> Date: Fri, 4 Oct 2024 07:26:40 +0100 Subject: [PATCH] fix not-deterministic log message (#6885) path list ordering --- .../deployment-bundle/esbuild-plugins/cloudflare-internal.ts | 4 +++- .../deployment-bundle/esbuild-plugins/hybrid-nodejs-compat.ts | 4 +++- .../src/deployment-bundle/esbuild-plugins/nodejs-compat.ts | 4 +++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/packages/wrangler/src/deployment-bundle/esbuild-plugins/cloudflare-internal.ts b/packages/wrangler/src/deployment-bundle/esbuild-plugins/cloudflare-internal.ts index 82b5703725a0..2d584d285912 100644 --- a/packages/wrangler/src/deployment-bundle/esbuild-plugins/cloudflare-internal.ts +++ b/packages/wrangler/src/deployment-bundle/esbuild-plugins/cloudflare-internal.ts @@ -19,7 +19,9 @@ export const cloudflareInternalPlugin: Plugin = { // imports of external modules such as `cloudflare:...`, // which won't be inlined/bundled by esbuild, are invalid. const pathList = new Intl.ListFormat("en-US").format( - Array.from(paths.keys()).map((p) => `"${p}"`) + Array.from(paths.keys()) + .map((p) => `"${p}"`) + .sort() ); throw new Error( dedent` diff --git a/packages/wrangler/src/deployment-bundle/esbuild-plugins/hybrid-nodejs-compat.ts b/packages/wrangler/src/deployment-bundle/esbuild-plugins/hybrid-nodejs-compat.ts index 51af155293ed..ed3c02b17fa7 100644 --- a/packages/wrangler/src/deployment-bundle/esbuild-plugins/hybrid-nodejs-compat.ts +++ b/packages/wrangler/src/deployment-bundle/esbuild-plugins/hybrid-nodejs-compat.ts @@ -38,7 +38,9 @@ function errorOnServiceWorkerFormat(build: PluginBuild) { build.onEnd(() => { if (build.initialOptions.format === "iife" && paths.size > 0) { const pathList = new Intl.ListFormat("en-US").format( - Array.from(paths.keys()).map((p) => `"${p}"`) + Array.from(paths.keys()) + .map((p) => `"${p}"`) + .sort() ); throw new Error( dedent` diff --git a/packages/wrangler/src/deployment-bundle/esbuild-plugins/nodejs-compat.ts b/packages/wrangler/src/deployment-bundle/esbuild-plugins/nodejs-compat.ts index 6d57de18332b..934de4611317 100644 --- a/packages/wrangler/src/deployment-bundle/esbuild-plugins/nodejs-compat.ts +++ b/packages/wrangler/src/deployment-bundle/esbuild-plugins/nodejs-compat.ts @@ -67,7 +67,9 @@ export const nodejsCompatPlugin: (silenceWarnings: boolean) => Plugin = ( warnedPackaged.size > 0 ) { const paths = new Intl.ListFormat("en-US").format( - Array.from(warnedPackaged.keys()).map((p) => `"${p}"`) + Array.from(warnedPackaged.keys()) + .map((p) => `"${p}"`) + .sort() ); throw new Error(` Unexpected external import of ${paths}. Imports are not valid in a Service Worker format Worker.