@@ -119,7 +119,8 @@ function webpackDebugIdInjectionPlugin(): UnpluginOptions {
119
119
120
120
function webpackDebugIdUploadPlugin (
121
121
upload : ( buildArtifacts : string [ ] ) => Promise < void > ,
122
- logger : Logger
122
+ logger : Logger ,
123
+ forceExitOnBuildCompletion ?: boolean
123
124
) : UnpluginOptions {
124
125
const pluginName = "sentry-webpack-debug-id-upload-plugin" ;
125
126
return {
@@ -136,7 +137,7 @@ function webpackDebugIdUploadPlugin(
136
137
} ) ;
137
138
} ) ;
138
139
139
- if ( compiler . options . mode === "production" ) {
140
+ if ( forceExitOnBuildCompletion && compiler . options . mode === "production" ) {
140
141
compiler . hooks . done . tap ( pluginName , ( ) => {
141
142
setTimeout ( ( ) => {
142
143
logger . debug ( "Exiting process after debug file upload" ) ;
@@ -184,8 +185,24 @@ const sentryUnplugin = sentryUnpluginFactory({
184
185
bundleSizeOptimizationsPlugin : webpackBundleSizeOptimizationsPlugin ,
185
186
} ) ;
186
187
188
+ type SentryWebpackPluginOptions = Options & {
189
+ _experiments ?: Options [ "_experiments" ] & {
190
+ /**
191
+ * If enabled, the webpack plugin will exit the build process after the build completes.
192
+ * Use this with caution, as it will terminate the process.
193
+ *
194
+ * More information: https://github.com/getsentry/sentry-javascript-bundler-plugins/issues/345
195
+ *
196
+ * @default false
197
+ */
198
+ forceExitOnBuildCompletion ?: boolean ;
199
+ } ;
200
+ } ;
201
+
187
202
// eslint-disable-next-line @typescript-eslint/no-explicit-any
188
- export const sentryWebpackPlugin : ( options ?: Options ) => any = sentryUnplugin . webpack ;
203
+ export const sentryWebpackPlugin : ( options ?: SentryWebpackPluginOptions ) => any =
204
+ sentryUnplugin . webpack ;
189
205
190
206
export { sentryCliBinaryExists } from "@sentry/bundler-plugin-core" ;
191
- export type { Options as SentryWebpackPluginOptions } from "@sentry/bundler-plugin-core" ;
207
+
208
+ export type { SentryWebpackPluginOptions } ;
0 commit comments