Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions packages/nextjs/src/config/webpack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -325,11 +325,17 @@ export function getWebpackPluginOptions(
}

/**
* NOTE: `eval` usage is a workaround for @vercel/nft detecting the binary itself as the hard dependency
* and effectively always including it in the bundle, which is not what we want.
* NOTE: We're faking `require.resolve` here as a workaround for @vercel/nft detecting the binary itself as a hard
* dependency and always including it in the bundle, which is not what we want.
*
* ref: https://github.com/getsentry/sentry-javascript/issues/3865
* ref: https://github.com/vercel/nft/issues/203
*/
function ensureCLIBinaryExists(): boolean {
return eval("fs.existsSync(path.join(require.resolve('@sentry/cli'), '../../sentry-cli'))");
for (const node_modulesPath of module.paths) {
if (fs.existsSync(path.resolve(node_modulesPath, '@sentry/cli/sentry-cli'))) {
return true;
}
}
return false;
}