Skip to content

Commit bdbd541

Browse files
authored
feat(nextjs): Include static/chunks/main-* files for widenClientFileUpload (#16406)
1 parent 56137a8 commit bdbd541

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

packages/nextjs/src/config/webpackPluginOptions.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,15 @@ export function getWebpackPluginOptions(
4141
);
4242
}
4343

44-
// TODO: We should think about uploading these when `widenClientFileUpload` is `true`. They may be useful in some situations.
44+
// We want to include main-* files if widenClientFileUpload is true as they have proven to be useful
45+
if (!sentryBuildOptions.widenClientFileUpload) {
46+
sourcemapUploadIgnore.push(path.posix.join(distDirAbsPath, 'static', 'chunks', 'main-*'));
47+
}
48+
49+
// Always ignore framework, polyfills, and webpack files
4550
sourcemapUploadIgnore.push(
4651
path.posix.join(distDirAbsPath, 'static', 'chunks', 'framework-*'),
4752
path.posix.join(distDirAbsPath, 'static', 'chunks', 'framework.*'),
48-
path.posix.join(distDirAbsPath, 'static', 'chunks', 'main-*'),
4953
path.posix.join(distDirAbsPath, 'static', 'chunks', 'polyfills-*'),
5054
path.posix.join(distDirAbsPath, 'static', 'chunks', 'webpack-*'),
5155
);

packages/nextjs/test/config/webpack/webpackPluginOptions.test.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,9 @@ describe('getWebpackPluginOptions()', () => {
153153
expect(generatedPluginOptions.sourcemaps).toMatchObject({
154154
assets: ['/my/project/dir/.next/static/chunks/pages/**', '/my/project/dir/.next/static/chunks/app/**'],
155155
ignore: [
156+
'/my/project/dir/.next/static/chunks/main-*',
156157
'/my/project/dir/.next/static/chunks/framework-*',
157158
'/my/project/dir/.next/static/chunks/framework.*',
158-
'/my/project/dir/.next/static/chunks/main-*',
159159
'/my/project/dir/.next/static/chunks/polyfills-*',
160160
'/my/project/dir/.next/static/chunks/webpack-*',
161161
],
@@ -170,7 +170,6 @@ describe('getWebpackPluginOptions()', () => {
170170
ignore: [
171171
'/my/project/dir/.next/static/chunks/framework-*',
172172
'/my/project/dir/.next/static/chunks/framework.*',
173-
'/my/project/dir/.next/static/chunks/main-*',
174173
'/my/project/dir/.next/static/chunks/polyfills-*',
175174
'/my/project/dir/.next/static/chunks/webpack-*',
176175
],
@@ -197,7 +196,6 @@ describe('getWebpackPluginOptions()', () => {
197196
ignore: [
198197
'C:/my/windows/project/dir/.dist/v1/static/chunks/framework-*',
199198
'C:/my/windows/project/dir/.dist/v1/static/chunks/framework.*',
200-
'C:/my/windows/project/dir/.dist/v1/static/chunks/main-*',
201199
'C:/my/windows/project/dir/.dist/v1/static/chunks/polyfills-*',
202200
'C:/my/windows/project/dir/.dist/v1/static/chunks/webpack-*',
203201
],

0 commit comments

Comments
 (0)