This repository was archived by the owner on Nov 20, 2023. It is now read-only.
This repository was archived by the owner on Nov 20, 2023. It is now read-only.
[nextjs] When adding sentry modules are getting imported as undefined #442
Closed
Description
Environment
What version are you running? Etc.
"@sentry/nextjs": "^7.50.0"
Steps to Reproduce
When using default imports/exports, somehow the module becomes undefined:
// redispool.ts
const redisPool = new RedisPool(redisUrl);
export default redisPool;
// index.ts
import redisPool from './redispool';
console.log({redisPool}) // undefined
Changing to use named exports fixes this issue:
// redispool.ts
export const redisPool = new RedisPool(redisUrl);
// index.ts
import { redisPool } from './redispool';
console.log({redisPool}) // redisPool: RedisPool
Really confused why this is happening. If I don't use sentry it works perfectly fine.
Does sentry expect all imports to be named?
This is my next.config.js
:
const sentryWebpackConfig = {
// For all available options, see:
// https://github.com/getsentry/sentry-webpack-plugin#options
// Suppresses source map uploading logs during build
silent: true,
org: 'my-org',
project: 'javascript-nextjs',
};
const sentryConfig = {
// For all available options, see:
// https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/
// Hides source maps from generated client bundles
hideSourceMaps: true,
// Automatically tree-shake Sentry logger statements to reduce bundle size
disableLogger: true,
};
const isProduction = process.env.NODE_ENV === 'production';
module.exports = isProduction
? withSentryConfig(nextConfig, sentryWebpackConfig, sentryConfig)
: nextConfig;
Metadata
Metadata
Assignees
Labels
No labels