Skip to content

Commit 26ac994

Browse files
author
Luca Forstner
authored
fix: Exclude node_modules from release injection (#143)
1 parent d1a3f37 commit 26ac994

File tree

1 file changed

+3
-2
lines changed
  • packages/bundler-plugin-core/src

1 file changed

+3
-2
lines changed

packages/bundler-plugin-core/src/index.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import path from "path";
2828
// This probably doesn't work for all bundlers but for rollup it does.
2929
const RELEASE_INJECTOR_ID = "\0sentry-release-injector";
3030

31-
const ALLOWED_TRANSFORMATION_FILE_ENDINGS = [".js", ".ts", ".jsx", ".tsx", ".cjs", ".mjs"];
31+
const ALLOWED_TRANSFORMATION_FILE_ENDINGS = [".js", ".ts", ".jsx", ".tsx", ".mjs"];
3232

3333
/**
3434
* The sentry bundler plugin concerns itself with two things:
@@ -233,13 +233,14 @@ const unplugin = createUnplugin<Options>((options, unpluginMetaContext) => {
233233
}
234234
});
235235
} else {
236+
const isInNodeModules = normalizedId.split(path.sep).includes("node_modules");
236237
const pathIsOrdinary = !normalizedId.includes("?") && !normalizedId.includes("#");
237238

238239
const pathHasAllowedFileEnding = ALLOWED_TRANSFORMATION_FILE_ENDINGS.some(
239240
(allowedFileEnding) => normalizedId.endsWith(allowedFileEnding)
240241
);
241242

242-
return pathIsOrdinary && pathHasAllowedFileEnding;
243+
return !isInNodeModules && pathIsOrdinary && pathHasAllowedFileEnding;
243244
}
244245
},
245246

0 commit comments

Comments
 (0)