1
1
/* eslint-disable max-lines */
2
+ // eslint-disable-next-line import/no-extraneous-dependencies
3
+ import * as SentryCLI from '@sentry/cli' ;
2
4
import { getSentryRelease } from '@sentry/node' ;
3
5
import { arrayify , dropUndefinedKeys , escapeStringForRegex , logger } from '@sentry/utils' ;
4
6
import { default as SentryWebpackPlugin } from '@sentry/webpack-plugin' ;
@@ -456,22 +458,6 @@ export function getWebpackPluginOptions(
456
458
return { ...defaultPluginOptions , ...userPluginOptions } ;
457
459
}
458
460
459
- /**
460
- * NOTE: We're faking `require.resolve` here as a workaround for @vercel/nft detecting the binary itself as a hard
461
- * dependency and always including it in the bundle, which is not what we want.
462
- *
463
- * ref: https://github.com/getsentry/sentry-javascript/issues/3865
464
- * ref: https://github.com/vercel/nft/issues/203
465
- */
466
- function ensureCLIBinaryExists ( ) : boolean {
467
- for ( const node_modulesPath of module . paths ) {
468
- if ( fs . existsSync ( path . resolve ( node_modulesPath , '@sentry/cli/sentry-cli' ) ) ) {
469
- return true ;
470
- }
471
- }
472
- return false ;
473
- }
474
-
475
461
/** Check various conditions to decide if we should run the plugin */
476
462
function shouldEnableWebpackPlugin ( buildContext : BuildContext , userSentryOptions : UserSentryOptions ) : boolean {
477
463
const { isServer, dev : isDev } = buildContext ;
@@ -485,7 +471,7 @@ function shouldEnableWebpackPlugin(buildContext: BuildContext, userSentryOptions
485
471
// architecture-specific version of the `sentry-cli` binary. If `yarn install`, `npm install`, or `npm ci` are run
486
472
// with the `--ignore-scripts` option, this will be blocked and the missing binary will cause an error when users
487
473
// try to build their apps.)
488
- if ( ! ensureCLIBinaryExists ( ) ) {
474
+ if ( ! fs . existsSync ( SentryCLI . default . getPath ( ) ) ) {
489
475
return false ;
490
476
}
491
477
0 commit comments