Skip to content

Commit 421ee29

Browse files
author
Luca Forstner
authored
ref(core): Don't interact with Sentry in watch-mode (#199)
1 parent f5db486 commit 421ee29

File tree

1 file changed

+35
-33
lines changed
  • packages/bundler-plugin-core/src

1 file changed

+35
-33
lines changed

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

Lines changed: 35 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -307,40 +307,42 @@ const unplugin = createUnplugin<Options>((options, unpluginMetaContext) => {
307307
let tmpUploadFolder: string | undefined;
308308

309309
try {
310-
if (internalOptions._experiments.debugIdUpload) {
311-
const debugIdChunkFilePaths = (
312-
await glob(internalOptions._experiments.debugIdUpload.include, {
313-
absolute: true,
314-
nodir: true,
315-
ignore: internalOptions._experiments.debugIdUpload.ignore,
316-
})
317-
).filter((p) => p.endsWith(".js") || p.endsWith(".mjs"));
318-
319-
const sourceFileUploadFolderPromise = util.promisify(fs.mkdtemp)(
320-
path.join(os.tmpdir(), "sentry-bundler-plugin-upload-")
321-
);
322-
323-
await Promise.all(
324-
debugIdChunkFilePaths.map(async (chunkFilePath, chunkIndex): Promise<void> => {
325-
await prepareBundleForDebugIdUpload(
326-
chunkFilePath,
327-
await sourceFileUploadFolderPromise,
328-
String(chunkIndex),
329-
logger
330-
);
331-
})
332-
);
333-
334-
tmpUploadFolder = await sourceFileUploadFolderPromise;
335-
await uploadDebugIdSourcemaps(internalOptions, ctx, tmpUploadFolder, releaseName);
336-
}
310+
if (!unpluginMetaContext.watchMode) {
311+
if (internalOptions._experiments.debugIdUpload) {
312+
const debugIdChunkFilePaths = (
313+
await glob(internalOptions._experiments.debugIdUpload.include, {
314+
absolute: true,
315+
nodir: true,
316+
ignore: internalOptions._experiments.debugIdUpload.ignore,
317+
})
318+
).filter((p) => p.endsWith(".js") || p.endsWith(".mjs"));
319+
320+
const sourceFileUploadFolderPromise = util.promisify(fs.mkdtemp)(
321+
path.join(os.tmpdir(), "sentry-bundler-plugin-upload-")
322+
);
323+
324+
await Promise.all(
325+
debugIdChunkFilePaths.map(async (chunkFilePath, chunkIndex): Promise<void> => {
326+
await prepareBundleForDebugIdUpload(
327+
chunkFilePath,
328+
await sourceFileUploadFolderPromise,
329+
String(chunkIndex),
330+
logger
331+
);
332+
})
333+
);
334+
335+
tmpUploadFolder = await sourceFileUploadFolderPromise;
336+
await uploadDebugIdSourcemaps(internalOptions, ctx, tmpUploadFolder, releaseName);
337+
}
337338

338-
await createNewRelease(internalOptions, ctx, releaseName);
339-
await cleanArtifacts(internalOptions, ctx, releaseName);
340-
await uploadSourceMaps(internalOptions, ctx, releaseName);
341-
await setCommits(internalOptions, ctx, releaseName);
342-
await finalizeRelease(internalOptions, ctx, releaseName);
343-
await addDeploy(internalOptions, ctx, releaseName);
339+
await createNewRelease(internalOptions, ctx, releaseName);
340+
await cleanArtifacts(internalOptions, ctx, releaseName);
341+
await uploadSourceMaps(internalOptions, ctx, releaseName);
342+
await setCommits(internalOptions, ctx, releaseName);
343+
await finalizeRelease(internalOptions, ctx, releaseName);
344+
await addDeploy(internalOptions, ctx, releaseName);
345+
}
344346
transaction?.setStatus("ok");
345347
} catch (e: unknown) {
346348
transaction?.setStatus("cancelled");

0 commit comments

Comments
 (0)