Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update trace ignore check to check reasons correctly #35511

Merged
merged 1 commit into from Mar 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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
@@ -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
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