-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(core): Pass module
into loadModule
#15139
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @jrandolf thanks for contributing! This sounds reasonable to me. Let's see if CI agrees :) In the current state, this would be a breaking change which is fine, since we're working on v9 of the SDK anyway. If you'd like to see this released for v8 of the SDK, we need to make the new parameter optional, so that there's no API breakage.
I'm just a bit surprised that this surfaces only now, given that pnpm and NextJS are used quite frequently, I'd imagine.
9a2ab42
to
e30fc15
Compare
heads-up: just assigning myself to review and merge this on Monday. Restarted CI in the meantime. Thanks for making the parameter optional! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
The `loadModule` function currently utilizes `require` to load modules starting from the `@sentry/core` directory. This approach is incompatible with package managers like pnpm, which do not hoist dependencies. Consequently, when another module, such as @sentry/nextjs, invokes `loadModule`, it fails to locate its own dependencies because the search initiates within the @sentry/core tree.
This PR adds the external contributor to the CHANGELOG.md file, so that they are credited for their contribution. See #15139 --------- Co-authored-by: Lukas Stracke <lukas.stracke@sentry.io>
yarn lint
) & (yarn test
).Certainly! Here’s a more elegantly phrased version of your content:
The
loadModule
function currently utilizesrequire
to load modules starting from the@sentry/core
directory. This approach is incompatible with package managers like pnpm, which do not hoist dependencies. Consequently, when another module, such as @sentry/nextjs, invokesloadModule
, it fails to locate its own dependencies because the search initiates within the @sentry/core tree.Example Scenario
Current Behavior:
If @sentry/nextjs calls
loadModule('@sentry/webpack-plugin')
, the function attempts to locate @sentry/webpack-plugin within the dependencies of @sentry/core. This results in the module not being found if@sentry/webpack-plugin
is not a dependency of@sentry/core
.Proposed Change:
With the current pull request, invoking
loadModule('@sentry/webpack-plugin', module)
directs the search to the dependencies of @sentry/nextjs instead of @sentry/core. This ensures that loadModule correctly resolves modules based on the calling module’s dependency tree, accommodating environments where dependencies are not hoisted.