Skip to content

feat: Remove support for initialising via --require#22513

Open
timfish wants to merge 1 commit into
developfrom
timfish/feat/no-longer-support---require
Open

feat: Remove support for initialising via --require#22513
timfish wants to merge 1 commit into
developfrom
timfish/feat/no-longer-support---require

Conversation

@timfish

@timfish timfish commented Jul 22, 2026

Copy link
Copy Markdown
Collaborator

Initialising via --require results in the SDK being loaded and initialised in Node's ESM loader thread 🤯

This causes numerous issues:

The last straw way failing to require(esm). This stops us from using any import/require chain that results in CJS requiring ESM. It's part of the reason /server-utils/src/orchestrion/runtime/register.ts needed to do lazy loading.

Since it's so problematic and --import supports loading ESM or CJS everywhere, we should remove support and warn users!

@github-actions

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size % Change Change
@sentry/browser 27.78 kB - -
@sentry/browser - with treeshaking flags 26.22 kB - -
@sentry/browser (incl. Tracing) 46.61 kB - -
@sentry/browser (incl. Tracing + Span Streaming) 48.42 kB - -
@sentry/browser (incl. Tracing, Profiling) 51.41 kB - -
@sentry/browser (incl. Tracing, Replay) 85.85 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 75.5 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 90.58 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 103.24 kB - -
@sentry/browser (incl. Feedback) 44.97 kB - -
@sentry/browser (incl. sendFeedback) 32.58 kB - -
@sentry/browser (incl. FeedbackAsync) 37.64 kB - -
@sentry/browser (incl. Metrics) 28.86 kB - -
@sentry/browser (incl. Logs) 29.09 kB - -
@sentry/browser (incl. Metrics & Logs) 29.79 kB - -
@sentry/react 29.57 kB - -
@sentry/react (incl. Tracing) 48.89 kB - -
@sentry/vue 33.21 kB - -
@sentry/vue (incl. Tracing) 48.58 kB - -
@sentry/svelte 27.8 kB - -
CDN Bundle 30.12 kB - -
CDN Bundle (incl. Tracing) 48.5 kB - -
CDN Bundle (incl. Logs, Metrics) 31.7 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 49.8 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) 70.96 kB - -
CDN Bundle (incl. Tracing, Replay) 86.01 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 87.33 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 91.82 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 93.08 kB - -
CDN Bundle - uncompressed 89.75 kB - -
CDN Bundle (incl. Tracing) - uncompressed 146.63 kB - -
CDN Bundle (incl. Logs, Metrics) - uncompressed 94.47 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 150.61 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 219.23 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 265.87 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 269.83 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 279.57 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 283.53 kB - -
@sentry/nextjs (client) 51.4 kB - -
@sentry/sveltekit (client) 47.03 kB - -
@sentry/core/server 80.14 kB - -
@sentry/core/browser 51.99 kB - -
@sentry/node 124.59 kB +0.26% +320 B 🔺
@sentry/node (incl. diagnostics channel injection) 150.03 kB +0.22% +328 B 🔺
@sentry/node/import (ESM hook with diagnostics-channel injection) 70.03 kB - -
@sentry/node - without tracing 74.78 kB +0.46% +340 B 🔺
@sentry/aws-serverless 84.26 kB +0.41% +342 B 🔺
@sentry/cloudflare (withSentry) - minified 196.64 kB - -
@sentry/cloudflare (withSentry) 483.92 kB - -

View base workflow run

@timfish
timfish marked this pull request as ready for review July 22, 2026 17:38
@timfish
timfish requested review from a team as code owners July 22, 2026 17:38
@timfish
timfish requested review from JPeer264, Lms24, isaacs and logaretm and removed request for a team July 22, 2026 17:38

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 143a4cc. Configure here.

const joinedArgs = execArgv.join(' ');
const importPaths = Array.from(joinedArgs.matchAll(/--import[ =](\S+)/g)).map(e => resolve(cwd, e[1] || ''));
const requirePaths = Array.from(joinedArgs.matchAll(/--require[ =](\S+)/g)).map(e => resolve(cwd, e[1] || ''));
const requirePaths = Array.from(joinedArgs.matchAll(/(?:--require|-r)[ =](\S+)/g)).map(e => resolve(cwd, e[1] || ''));

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Require warning misses package preloads

Medium Severity

The new --require migration warning relies on getEntryPointType(), but parseProcessPaths resolves preload targets with path.resolve(cwd, ...). Package specifiers like @sentry/node/init never match real stack filenames under node_modules, so the documented no-code --require entry points silently skip the warning.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 143a4cc. Configure here.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

That's ok

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.

1 participant