Skip to content

Commit a2accb2

Browse files
authored
Update trace ignore check to check reasons correctly (#35511)
1 parent c261924 commit a2accb2

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

packages/next/build/webpack/plugins/next-trace-entrypoints-plugin.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,9 @@ export class TraceEntryPointsPlugin implements webpack5.WebpackPluginInstance {
365365
// static image imports, CSS imports
366366
file = nodePath.join(this.tracingRoot, file)
367367
const depMod = depModMap.get(file)
368-
const isAsset = reasons.get(file)?.type.includes('asset')
368+
const isAsset = reasons
369+
.get(nodePath.relative(this.tracingRoot, file))
370+
?.type.includes('asset')
369371

370372
return (
371373
!isAsset &&

test/integration/production/pages/api/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import fs from 'fs'
22
import path from 'path'
3-
import data from '../../static/hello.json'
3+
import css from '../../components/logo/logo.module.css'
44

55
export default (req, res) => {
66
console.log({
7-
importedData: data,
7+
importedData: css,
88
fsLoadedData: fs.readFileSync(
9-
path.join(process.cwd(), 'static', 'hello.json'),
9+
path.join(process.cwd(), 'components', 'logo', 'logo.module.css'),
1010
'utf8'
1111
),
1212
})

test/integration/production/test/index.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ describe('Production Usage', () => {
225225
},
226226
{
227227
page: '/api',
228-
tests: [/webpack-runtime\.js/, /static\/hello\.json/],
228+
tests: [/webpack-runtime\.js/, /\/logo\.module\.css/],
229229
notTests: [
230230
/next\/dist\/server\/next\.js/,
231231
/next\/dist\/bin/,

0 commit comments

Comments
 (0)