11/* eslint-disable max-lines */
2+ // eslint-disable-next-line import/no-extraneous-dependencies
3+ import * as SentryCLI from '@sentry/cli' ;
24import { getSentryRelease } from '@sentry/node' ;
35import { arrayify , dropUndefinedKeys , escapeStringForRegex , logger } from '@sentry/utils' ;
46import { default as SentryWebpackPlugin } from '@sentry/webpack-plugin' ;
@@ -456,22 +458,6 @@ export function getWebpackPluginOptions(
456458 return { ...defaultPluginOptions , ...userPluginOptions } ;
457459}
458460
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-
475461/** Check various conditions to decide if we should run the plugin */
476462function shouldEnableWebpackPlugin ( buildContext : BuildContext , userSentryOptions : UserSentryOptions ) : boolean {
477463 const { isServer, dev : isDev } = buildContext ;
@@ -485,7 +471,7 @@ function shouldEnableWebpackPlugin(buildContext: BuildContext, userSentryOptions
485471 // architecture-specific version of the `sentry-cli` binary. If `yarn install`, `npm install`, or `npm ci` are run
486472 // with the `--ignore-scripts` option, this will be blocked and the missing binary will cause an error when users
487473 // try to build their apps.)
488- if ( ! ensureCLIBinaryExists ( ) ) {
474+ if ( ! fs . existsSync ( SentryCLI . default . getPath ( ) ) ) {
489475 return false ;
490476 }
491477
0 commit comments