Skip to content

@sentry/nextjs 8.40.0 Error require() of ES Module #14498

Open

Description

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/nextjs

SDK Version

8.40.0

Framework Version

Next 15.0.4-canary.28

Link to Sentry event

No response

Reproduction Example/SDK Setup

Any Next.js 15 + Sentry 8.40.0 template/basic application deployed to Vercel.

Steps to Reproduce

  1. npx create-next-app --example with-sentry nextjs-sentry-example
  2. Ensure [email protected] installed
  3. Build project locally (Build should pass)
  4. Deploy project to Vercel (Build should fail)
  5. Downgrade to [email protected]
  6. Deploy project to Vercel (Build should pass)

Expected Result

Build should pass in Vercel

Actual Result

unhandledRejection Error: require() of ES Module /vercel/path0/node_modules/chalk/source/index.js from /vercel/path0/node_modules/@sentry/nextjs/build/cjs/config/webpack.js not supported.
Instead change the require of index.js in /vercel/path0/node_modules/@sentry/nextjs/build/cjs/config/webpack.js to a dynamic import() which is available in all CommonJS modules.
    at mod.require (node_modules/next/dist/server/require-hook.js:65:28)
    at Object.<anonymous> (../../node_modules/@sentry/nextjs/build/cjs/config/webpack.js:12:15) {
  type: 'Error',
  code: 'ERR_REQUIRE_ESM'
}
error: script "build" exited with code 1
Error: Command "bun run build" exited with 1

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    Package: nextjsIssues related to the Sentry Nextjs SDK

    Type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions