Skip to content

Commit 5f9a08a

Browse files
committed
exclude webpack.ts but not withSentryConfig.ts
1 parent 7e1b8bc commit 5f9a08a

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

packages/nextjs/src/config/webpack.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,14 +106,15 @@ export function constructWebpackConfigFunction(
106106

107107
// Prevent `@vercel/nft` (which nextjs uses to determine which files are needed when packaging up a lambda) from
108108
// including any of our build-time code or dependencies. (Otherwise it'll include files like this one and even the
109-
// entirety of rollup and sucrase.)
109+
// entirety of rollup and sucrase.) Since this file is the root of that dependency tree, it's enough to just
110+
// exclude it and the rest will be excluded as well.
110111
const nftPlugin = newConfig.plugins?.find((plugin: WebpackPluginInstance) => {
111112
const proto = Object.getPrototypeOf(plugin) as WebpackPluginInstance;
112113
return proto.constructor.name === 'TraceEntryPointsPlugin';
113114
}) as WebpackPluginInstance & { excludeFiles: string[] };
114115
if (nftPlugin) {
115116
if (Array.isArray(nftPlugin.excludeFiles)) {
116-
nftPlugin.excludeFiles.push(path.join(__dirname, 'withSentryConfig.js'));
117+
nftPlugin.excludeFiles.push(__filename);
117118
} else {
118119
__DEBUG_BUILD__ &&
119120
logger.warn(

0 commit comments

Comments
 (0)