sentry-javascript
sentry-javascript copied to clipboard
@sentry/nextjs build fails on Yarn PnP mode
Is there an existing issue for this?
- [x] I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues
- [x] I have reviewed the documentation https://docs.sentry.io/
- [x] I am using the latest SDK release https://github.com/getsentry/sentry-javascript/releases
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
https://github.com/getsentry/sentry-javascript/blob/0d79b51e7ecbe26b1b235ed92410d2d07febdcde/packages/nextjs/src/config/webpack.ts#L335
Above part changed 6 months ago, I believe it fails on Yarn PnP since then.
https://github.com/getsentry/sentry-javascript/blob/0d79b51e7ecbe26b1b235ed92410d2d07febdcde/packages/utils/src/node.ts#L57
Inside function loadmodule
, node_modules is hard-coded which will always returns undefined
Steps to Reproduce
- Setup yarn pnp workspace
- Import
withSentryConfig
from@sentry/nextjs
inside next.config.js - Run
next build
Expected Result
Build success
Actual Result
TypeError: Cannot destructure property 'sentryWebpackPlugin' of 'utils.loadModule(...)' as it is undefined.