-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Description
Problem
@sentry/tanstackstart-react@10.39.0 includes @sentry/vite-plugin as a runtime dependency, causing ERR_MODULE_NOT_FOUND errors in production when using pnpm for deployment.
Expected Behavior
Build-time tools like Vite plugins should be:
- Listed as
peerDependenciesin the framework SDK (optional) - Installed as
devDependenciesby the user - Never included as runtime
dependencies
This is the pattern used by other framework integrations and documented in Sentry's own bundler plugin documentation.
Actual Behavior
// @sentry/tanstackstart-react@10.39.0/package.json
{
"dependencies": {
"@sentry/vite-plugin": "^4.8.0" // ← WRONG
}
}This pulls @sentry/bundler-plugin-core and @babel/core (+ ~50 Babel plugins) into production bundles.
Runtime Errors in Production
When deployed with pnpm, these packages aren't hoisted by default, causing:
Error [ERR_MODULE_NOT_FOUND]: Cannot find package '@babel/core'
imported from /app/.output/server/node_modules/@sentry/bundler-plugin-core/dist/esm/index.mjs
Similar errors occur for:
@opentelemetry/instrumentation- Various
@sentry/*and@babel/*packages
Reproduction
- Create TanStack Start app with
@sentry/tanstackstart-react@10.39.0 - Deploy using
pnpm deploy --prod(or any pnpm-based deployment) - Run the deployed app
- Observe runtime import errors
Environment
- Package:
@sentry/tanstackstart-react@10.39.0 - Runtime: Node.js production deployment (Docker, serverless, etc.)
- Package Manager: pnpm v10 (with default hoisting behavior)
- Framework: TanStack Start v1.160.0
Workaround
Add to .npmrc:
public-hoist-pattern[]=*@opentelemetry/*
public-hoist-pattern[]=*@sentry/*
public-hoist-pattern[]=*@babel/*This forces pnpm to hoist these packages, but has significant drawbacks:
- Security: Bundles ~5-10MB of build tools in production
- Performance: Extra memory overhead and slower cold starts
- Bundle size: Babel + plugins unnecessarily inflates deployments
Requested Fix
Remove @sentry/vite-plugin from dependencies in @sentry/tanstackstart-react/package.json:
{
- "dependencies": {
- "@sentry/vite-plugin": "^4.8.0"
- },
+ "peerDependencies": {
+ "@sentry/vite-plugin": "^4.8.0"
+ },
+ "peerDependenciesMeta": {
+ "@sentry/vite-plugin": {
+ "optional": true
+ }
+ }
}And update documentation to have users install @sentry/vite-plugin as a devDependency.
Similar Issues
This is the exact same problem that exists with other framework SDKs:
- Deployment on Netlify using SvelteKit succeeding during build but failing during requests (Cannot find module '@sentry/bundler-plugin-core/sentry-release-injection-file') #9544 -
@sentry/sveltekitwith Netlify deployments - Both cases: bundler plugins incorrectly bundled as runtime dependencies
Additional Context
- Latest version checked:
@sentry/tanstackstart-react@10.39.0(2026-02-16) - Issue persists across all 10.x versions
- Affects any deployment using pnpm or strict dependency managers
- Workaround reference: sortie-code/sortie@9ca8966
Build tools should never be runtime dependencies. This packaging bug:
- Violates npm/pnpm best practices
- Creates security surface area (unnecessary code in production)
- Degrades performance (bundle bloat, memory overhead)
- Breaks deployments with proper dependency isolation
Please consider fixing this packaging issue to align with other Sentry framework SDKs and standard npm practices.
Metadata
Metadata
Assignees
Projects
Status