Skip to content

Commit 5fdcf7d

Browse files
committed
fix(e2e): configure Next.js to use development export conditions
Next.js/webpack doesn't use the 'development' export condition by default, even in 'next dev' mode. Added webpack config to enable it, which allows the SDK's development-only features like Spotlight auto-enablement to work.
1 parent cb298e2 commit 5fdcf7d

File tree

1 file changed

+13
-0
lines changed
  • dev-packages/e2e-tests/test-applications/nextjs-15-spotlight

1 file changed

+13
-0
lines changed

dev-packages/e2e-tests/test-applications/nextjs-15-spotlight/next.config.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,19 @@ const nextConfig = {
77
env: {
88
NEXT_PUBLIC_SENTRY_SPOTLIGHT: 'true',
99
},
10+
11+
// Configure webpack to use 'development' export condition in dev mode
12+
// This enables Sentry SDK's development-only features like Spotlight auto-enablement
13+
webpack: (config, { dev }) => {
14+
if (dev) {
15+
// Add 'development' to the front of conditionNames to prioritize dev exports
16+
config.resolve.conditionNames = [
17+
'development',
18+
...(config.resolve.conditionNames || ['import', 'module', 'browser', 'require', 'node', 'default']),
19+
];
20+
}
21+
return config;
22+
},
1023
};
1124

1225
module.exports = withSentryConfig(nextConfig, {

0 commit comments

Comments
 (0)