From 8c1f40a5551e50946c68cd7aa2d4b7f91153702c Mon Sep 17 00:00:00 2001 From: Noah Santschi-Cooney Date: Tue, 14 May 2024 13:24:41 +0100 Subject: [PATCH] fix: remove module cache in sandbox plugin --- esbuild/private/plugins/bazel-sandbox.js | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/esbuild/private/plugins/bazel-sandbox.js b/esbuild/private/plugins/bazel-sandbox.js index 84f0921..c58b668 100644 --- a/esbuild/private/plugins/bazel-sandbox.js +++ b/esbuild/private/plugins/bazel-sandbox.js @@ -1,9 +1,6 @@ const path = require('path') const process = require('process') -// Regex matching any non-relative import path -const pkgImport = /^[^.]/ - const bindir = process.env.BAZEL_BINDIR const execroot = process.env.JS_BINARY__EXECROOT @@ -14,7 +11,6 @@ function bazelSandboxPlugin() { return { name: 'bazel-sandbox', setup(build) { - const moduleCache = new Map() build.onResolve( { filter: /./ }, async ({ path: importPath, ...otherOptions }) => { @@ -28,16 +24,6 @@ function bazelSandboxPlugin() { } otherOptions.pluginData.executedSandboxPlugin = true - // Prevent us from loading different forms of a module (CJS vs ESM). - if (pkgImport.test(importPath)) { - if (!moduleCache.has(importPath)) { - moduleCache.set( - importPath, - resolveInExecroot(build, importPath, otherOptions) - ) - } - return await moduleCache.get(importPath) - } return await resolveInExecroot(build, importPath, otherOptions) } )