Skip to content

Commit eedca87

Browse files
committed
fix(esbuild): clear state from previous builds for watch mode and tests
1 parent 0ec8c82 commit eedca87

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

packages/esbuild-plugin/src/index.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,9 @@ function esbuildDebugIdInjectionPlugin(logger: Logger): UnpluginOptions {
6363

6464
esbuild: {
6565
setup({ initialOptions, onLoad, onResolve }) {
66+
// Clear state from previous builds (important for watch mode and test suites)
67+
debugIdWrappedPaths.clear();
68+
6669
if (!initialOptions.bundle) {
6770
logger.warn(
6871
"The Sentry esbuild plugin only supports esbuild with `bundle: true` being set in the esbuild build options. Esbuild will probably crash now. Sorry about that. If you need to upload sourcemaps without `bundle: true`, it is recommended to use Sentry CLI instead: https://docs.sentry.io/platforms/javascript/sourcemaps/uploading/cli/"
@@ -177,6 +180,9 @@ function esbuildModuleMetadataInjectionPlugin(injectionCode: string): UnpluginOp
177180

178181
esbuild: {
179182
setup({ initialOptions, onLoad, onResolve }) {
183+
// Clear state from previous builds (important for watch mode and test suites)
184+
metadataProxyEntryPoints.clear();
185+
180186
onResolve({ filter: /.*/ }, (args) => {
181187
if (args.kind !== "entry-point") {
182188
return;

0 commit comments

Comments
 (0)