Skip to content

Next.js auto wrappers are creating wildcard exports and crashing builds #6085

@dhavalveera

Description

@dhavalveera

Environment

SaaS (https://sentry.io/)

Version

7.17.1

Steps to Reproduce

sentry.client.config.js & sentry.server.config.js => code:

import * as Sentry from '@sentry/nextjs'

if (process.env.SENTRY_DSN) {
  Sentry.init({
    dsn: process.env.SENTRY_DSN,
    //   enabled: process.env.NODE_ENV !== 'test',
    environment: 'production',
    // release: process.env.NEXT_PUBLIC_APP_VERSION_RELEASE, // Uses the environment variable `SENTRY_RELEASE`, which is also attached to the source maps
    //   debug: process.env.NODE_ENV === 'development', // You'll need to configure "debug" in sentry.x.config.js files as well as next.config.js
    tracesSampleRate: 1.0,
  })
}

next.config.js => Code:

/** @type {import('next').NextConfig} */

const { withSentryConfig } = require('@sentry/nextjs')

const nextConfig = {
  reactStrictMode: true,
  swcMinify: true,

  env: {
    SENTRY_DSN: process.env.NEXT_PUBLIC_SENTRY_DSN,
  },

  sentry: {
    // Use `hidden-source-map` rather than `source-map` as the Webpack `devtool`
    // for client-side builds. (This will be the default starting in
    // `@sentry/nextjs` version 8.0.0.) See
    // https://webpack.js.org/configuration/devtool/ and
    // https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/#use-hidden-source-map
    // for more information.
    hideSourceMaps: true,
  },
}
// Make sure adding Sentry options is the last code to run before exporting, to
// ensure that your source maps include changes from all other Webpack plugins
module.exports = withSentryConfig(nextConfig, {
  // Additional config options for the Sentry Webpack plugin. Keep in mind that
  // the following options are set automatically, and overriding them is not
  // recommended:
  //   release, url, org, project, authToken, configFile, stripPrefix,
  //   urlPrefix, include, ignore
  // For all available options, see:
  // https://github.com/getsentry/sentry-webpack-plugin#options.
})

Expected Result

no error should throw if the App is working properly

Actual Result

image

I am getting this error when I am normally running npm run dev. also I've some eslintrc.json

please help me where I'm doing wrong.

Metadata

Metadata

Assignees

Labels

Package: nextjsIssues related to the Sentry Nextjs SDK

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions