Skip to content

Commit

Permalink
Update trace ignore check to check reasons correctly (vercel#35511)
Browse files Browse the repository at this point in the history
  • Loading branch information
ijjk authored Mar 22, 2022
1 parent c261924 commit a2accb2
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,9 @@ export class TraceEntryPointsPlugin implements webpack5.WebpackPluginInstance {
// static image imports, CSS imports
file = nodePath.join(this.tracingRoot, file)
const depMod = depModMap.get(file)
const isAsset = reasons.get(file)?.type.includes('asset')
const isAsset = reasons
.get(nodePath.relative(this.tracingRoot, file))
?.type.includes('asset')

return (
!isAsset &&
Expand Down
6 changes: 3 additions & 3 deletions test/integration/production/pages/api/index.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import fs from 'fs'
import path from 'path'
import data from '../../static/hello.json'
import css from '../../components/logo/logo.module.css'

export default (req, res) => {
console.log({
importedData: data,
importedData: css,
fsLoadedData: fs.readFileSync(
path.join(process.cwd(), 'static', 'hello.json'),
path.join(process.cwd(), 'components', 'logo', 'logo.module.css'),
'utf8'
),
})
Expand Down
2 changes: 1 addition & 1 deletion test/integration/production/test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ describe('Production Usage', () => {
},
{
page: '/api',
tests: [/webpack-runtime\.js/, /static\/hello\.json/],
tests: [/webpack-runtime\.js/, /\/logo\.module\.css/],
notTests: [
/next\/dist\/server\/next\.js/,
/next\/dist\/bin/,
Expand Down

0 comments on commit a2accb2

Please sign in to comment.