Skip to content
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

ref(nextjs): Make build-time value injection turbopack compatible #14081

Merged
merged 9 commits into from
Nov 6, 2024

Conversation

lforst
Copy link
Member

@lforst lforst commented Oct 28, 2024

Ref: #8105

To inject build-time variables, in addition to doing so via a custom loader, we will be injecting them via the env option.

Caveat: We are currently using the Next.js build ID as a release name. This build id is passed to the webpack option. Since the webpack option doesn't exist for turbopack we don't have access to the build ID. For now we will simply not inject a release name, which may be better anyhow since turbopack is currently only stable for dev.

Copy link
Contributor

github-actions bot commented Oct 29, 2024

size-limit report 📦

Path Size % Change Change
@sentry/browser 22.76 KB - -
@sentry/browser - with treeshaking flags 21.54 KB - -
@sentry/browser (incl. Tracing) 35.25 KB - -
@sentry/browser (incl. Tracing, Replay) 71.96 KB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 62.35 KB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 76.3 KB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 89.11 KB - -
@sentry/browser (incl. Feedback) 39.9 KB - -
@sentry/browser (incl. sendFeedback) 27.4 KB - -
@sentry/browser (incl. FeedbackAsync) 32.2 KB - -
@sentry/react 25.51 KB - -
@sentry/react (incl. Tracing) 38.2 KB - -
@sentry/vue 26.9 KB - -
@sentry/vue (incl. Tracing) 37.08 KB - -
@sentry/svelte 22.89 KB - -
CDN Bundle 24.11 KB - -
CDN Bundle (incl. Tracing) 37 KB - -
CDN Bundle (incl. Tracing, Replay) 71.68 KB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 77.02 KB - -
CDN Bundle - uncompressed 70.66 KB - -
CDN Bundle (incl. Tracing) - uncompressed 109.84 KB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 222.36 KB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 235.58 KB - -
@sentry/nextjs (client) 38.31 KB +0.03% +10 B 🔺
@sentry/sveltekit (client) 35.83 KB - -
@sentry/node 131.52 KB - -
@sentry/node - without tracing 95.64 KB - -
@sentry/aws-serverless 105.91 KB - -

View base workflow run

@lforst lforst marked this pull request as ready for review November 4, 2024 15:43
@lforst lforst requested a review from chargome November 4, 2024 15:43
@OskarD
Copy link

OskarD commented Nov 5, 2024

Thank you for this!! I can't wait for faster build times during development! 🥳

@lforst
Copy link
Member Author

lforst commented Nov 6, 2024

@OskarD Unless you want to use Sentry during development (which would be of questionable value), you can already just switch to Turbopack! Sentry will not crash you or anything.

@OskarD
Copy link

OskarD commented Nov 6, 2024

@OskarD Unless you want to use Sentry during development (which would be of questionable value), you can already just switch to Turbopack! Sentry will not crash you or anything.

My hot reloading doesn't work, and I get these warnings:

[@sentry/nextjs] WARNING: You are using the Sentry SDK with next dev --turbo. The Sentry SDK doesn't yet fully support Turbopack. The SDK will not be loaded in the browser, and serverside instrumentation will be inaccurate or incomplete. Production builds without --turbowill still fully work. If you are just trying out Sentry or attempting to configure the SDK, we recommend temporarily removing the--turbo flag while you are developing locally. Follow this issue for progress on Sentry + Turbopack: https://github.com/getsentry/sentry-javascript/issues/8105. (You can suppress this warning by setting SENTRY_SUPPRESS_TURBOPACK_WARNING=1 as environment variable)

 ⚠ Webpack is configured while Turbopack is not, which may cause problems.
 ⚠ See instructions if you need to configure Turbopack:
  https://nextjs.org/docs/app/api-reference/next-config-js/turbo

I don't get them without the dependency installed

Copy link
Member

@chargome chargome left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, how will we handle this once turbopack is stable for prod?

@lforst
Copy link
Member Author

lforst commented Nov 6, 2024

@OskarD All of these are just warnings. Everything except for certain Sentry SDK features will operate normally.

The SDK causing MHR to not work is incredibly unlikely but I am happy to be proven wrong if you provide a reproduction example!

@lforst
Copy link
Member Author

lforst commented Nov 6, 2024

LGTM, how will we handle this once turbopack is stable for prod?

In theory, this should already work for prod turbopack. The only thing left is the release injection for which we need a breaking change.

@lforst lforst merged commit 3750914 into develop Nov 6, 2024
142 checks passed
@lforst lforst deleted the lforst-turbo-compatible-constant-injection branch November 6, 2024 11:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants