-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
fix(nextjs): Don't run webpack plugin on non-prod Vercel deployments #5603
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): Don't run webpack plugin on non-prod Vercel deployments #5603
Conversation
size-limit report 📦
|
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 @lobsterkatie!
Can we make sure that there is some test for this scenario?
Also, once we close this, we should try to understand how this can be solved in non-vercel environments.
39fc0be
to
003a6ec
Compare
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.
Looking good now! Thanks @lobsterkatie!
70bdd0c
to
6d723d9
Compare
6d723d9
to
ee43f3c
Compare
When someone adds our Vercel integration, it only adds sentry-cli-relevant environment variables to production deployments. This can cause non-production deployments to fail, because when the webpack loader tries to run, it doesn't find the information it needs. That said, there's a reason we only set the env variables for prod - we really shouldn't be creating releases or uploading sourcemaps for dev or preview deployments in any case.
This adds an environment check for vercel deployments (using the
VERCEL_ENV
env variable), and only enables the webpack plugin if the environment isproduction
. To give users a way to override this, settingdisableClientWebpackPlugin
ordisableServerWebpackPlugin
tofalse
now takes precedence over other checks, rather than being a no-op. Finally, given that the number of enablement checks is likely to grow, this pulls them into a separate function.This supersedes getsentry/sentry#37649.