Skip to content

@sentry/nextjs build fails on Yarn PnP mode #13641

Closed
@artechventure

Description

@artechventure

Is there an existing issue for this?

How do you use Sentry?

Self-hosted/on-premise

Which SDK are you using?

@sentry/nextjs

SDK Version

8.29.0

Framework Version

Next 14.2.5

Link to Sentry event

No response

Reproduction Example/SDK Setup

const { sentryWebpackPlugin } = loadModule('@sentry/webpack-plugin') as any;

Above part changed 6 months ago, I believe it fails on Yarn PnP since then.

mod = dynamicRequire(module, `${cwd()}/node_modules/${moduleName}`) as T;

Inside function loadmodule, node_modules is hard-coded which will always returns undefined

Steps to Reproduce

  1. Setup yarn pnp workspace
  2. Import withSentryConfig from @sentry/nextjs inside next.config.js
  3. Run next build

Expected Result

Build success

Actual Result

TypeError: Cannot destructure property 'sentryWebpackPlugin' of 'utils.loadModule(...)' as it is undefined.

Metadata

Metadata

Assignees

Labels

Package: nextjsIssues related to the Sentry Nextjs SDK

Type

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions