Skip to content

Commit 144a818

Browse files
author
Luca Forstner
authored
fix(core): Skip all transformations for 3rd party modules (#195)
1 parent 4aa2080 commit 144a818

File tree

1 file changed

+10
-0
lines changed
  • packages/bundler-plugin-core/src

1 file changed

+10
-0
lines changed

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,12 @@ const unplugin = createUnplugin<Options>((options, unpluginMetaContext) => {
133133
});
134134
}
135135

136+
if (process.cwd().match(/\\node_modules\\|\/node_modules\//)) {
137+
logger.warn(
138+
"Running Sentry plugin from within a `node_modules` folder. Some features may not work."
139+
);
140+
}
141+
136142
const releaseName = await releaseNamePromise;
137143

138144
// At this point, we either have determined a release or we have to bail
@@ -185,6 +191,10 @@ const unplugin = createUnplugin<Options>((options, unpluginMetaContext) => {
185191
transformInclude(id) {
186192
logger.debug('Called "transformInclude":', { id });
187193

194+
if (id.match(/\\node_modules\\|\/node_modules\//)) {
195+
return false; // never transform 3rd party modules
196+
}
197+
188198
// We normalize the id because vite always passes `id` as a unix style path which causes problems when a user passes
189199
// a windows style path to `releaseInjectionTargets`
190200
const normalizedId = path.normalize(id);

0 commit comments

Comments
 (0)