Skip to content

Commit eda94f7

Browse files
committed
add flag noting that webpack.ts has been loaded
1 parent 5f9a08a commit eda94f7

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

packages/nextjs/src/config/webpack.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,13 @@ export { SentryWebpackPlugin };
2727
// TODO: merge default SentryWebpackPlugin include with their SentryWebpackPlugin include
2828
// TODO: drop merged keys from override check? `includeDefaults` option?
2929

30+
// In order to make sure that build-time code isn't getting bundled in runtime bundles (specifically, in the serverless
31+
// functions into which nextjs converts a user's routes), we exclude this module (and all of its dependencies) from the
32+
// nft file manifests nextjs generates. (See the code dealing with the `TraceEntryPointsPlugin` below.) So that we don't
33+
// crash people, we therefore need to make sure nothing tries to either require this file or import from it. Setting
34+
// this env variable allows us to test whether or not that's happened.
35+
process.env.SENTRY_WEBPACK_MODULE_LOADED = 'true';
36+
3037
/**
3138
* Construct the function which will be used as the nextjs config's `webpack` value.
3239
*

0 commit comments

Comments
 (0)