-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
fix(nextjs): Fix conflict with other libraries modifying webpack entry
property
#3703
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(nextjs): Fix conflict with other libraries modifying webpack entry
property
#3703
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.
👍
size-limit report
|
Thanks for fixing it, will try if it works now :) |
I tried using the latest build 6.7.1 and sentry doesn't work with then i tried doing this
sentry is still not working I want to use next-pwa, SVG, and sentry together. |
Hey @nihalanisumit, we have not cut a release with this change yet. The next version of the SDK will have these changes. |
Solid one @lobsterkatie, keen for this release. |
@nihalanisumit, @anguskeatinge - this is out now, in 6.7.2 and higher. |
Amazing it works as expected!!! |
Just in time for us to change approaches and make the entire thing a moot point, LOL. That change should be released sometime next week. Glad it's working for you in the meantime, though! 🙂 |
In order to include the user's
sentry.client.config.js
code (which is whereSentry.init()
is called) in the browser bundle, we modify theentry
webpack configuration so that themain
entry point includes that file in addition to the core nextjs browser code.At some point in the past, that same entry point was called
main.js
, and next maintains code to preserve backwards compatibility with anything which still uses that name for it. In that code, anything inmain.js
is copied over tomain
beforemain.js
is deleted. Should be fine, right?It would be, except that instead of copying the
main.js
stuff into the current value ofmain
(which by that point includessentry.client.config.js
), it instead uses the originalmain
value (which doesn't include our code). Luckily for us, this only happens if there's anything actually inmain.js
, so as long as we can guarantee that it's empty, we're good.In most cases there's nothing to do, because it's empty by default. But currently, if another library has added something to it, it triggers next's copying over and the Sentry code is lost. This fixes that by doing the copying ourselves, and then emptying
main.js
before next can get ahold of it.Fixing this also exposed a mistake in our types, so that's fixed here as well.
Fixes #3538.