fix(build): suppress Turbopack over-bundling warning from agentSkills generator (#6582) - #6720
Merged
Merged
Conversation
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #6582
Root cause
src/lib/agentSkills/generator.ts:247buildsoutputBaseaspath.isAbsolute(outputDir) ? outputDir : path.join(process.cwd(), outputDir), whereoutputDiris a runtime function parameter, not a compile-time literal. Turbopack's build-time file-tracing analyzer can't statically narrow the dynamicreaddirSync/rmSync/readFileSync/writeFileSynccall sites a few lines below, so it falls back to a project-wide glob — once per Next.js entry point that imports the module (/api/agent-skills/generate,/api/cli-tools/pi-settings). #6366's commit message claimed to "anchor the base path with a literal" but the shipped code never did; a later "#6366 regression" fix only added anisAbsolute()guard for absolute test paths.Fix
Since the fs access is legitimate and bounded (
skills/<id>/SKILL.md, ~48 known IDs), rather than fight the analyzer,next.config.mjs'sturbopack.ignoreIssue(Next.js 16.2+) now suppresses this specific, known-benign diagnostic — mirroring the existingwebpack.ignoreWarnings/isNextIntlExtractorDynamicImportWarningprecedent already in the same file for the webpack path.TDD evidence
No unit-testable repro exists for a Turbopack compiler diagnostic (confirmed by prior
/triage-fix-bugsanalysis), so the regression guard is a config-shape assertion intests/unit/next-config.test.ts:next.config.mjs, noignoreIssuerule):Gates run (green)
node --import tsx/esm --test tests/unit/next-config.test.ts— 7/7 passdev-origins-config,redirects-cli-renames,mitm-stub-alias-6344,csp-lan-ws-5083,api/root-catchall-json-404) — 21/21 passnode scripts/check/check-file-size.mjs— OK, no violations on touched filesnode scripts/check/check-complexity.mjs— OK (2052 violations, baseline 2053)node scripts/check/check-cognitive-complexity.mjs— OK (884 violations, baseline 884)npx eslint --suppressions-location config/quality/eslint-suppressions.json next.config.mjs tests/unit/next-config.test.ts— exit 0node scripts/check/check-changelog-integrity.mjs— OKnpm run typecheck:core— pre-existing base-red onopen-sse/services/compression/engines/omniglyphAdapter.ts/stats.ts(missingomniglyphmodule, from feat(compression): omniglyph engine (context-as-image, Fable 5 direct) — stack + single mode #6556), unrelated to this diff (confirmed:git diff origin/release/v3.8.47 --stattouches onlyCHANGELOG.md,next.config.mjs,tests/unit/next-config.test.ts)No release-freeze active at time of PR (
gh issue list --label release-freeze --state openempty).