Repository navigation
fix(next-plugin): warn instead of failing on a prewarm file it cannot extract - #1031
Merged
Merged
Conversation
… extract The production prewarm keeps extracting every source file, but a file it cannot extract (dead source no route imports) is now skipped with a warning naming the file and the error. If Next.js or webpack compiles the file, its loader still fails the build with the same error. Refs #686 (NXT-12) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… the loader still fails Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests.
🚀 New features to boost your workflow:
|
This was referenced Nov 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
Refs #686 (NXT-12)
Summary
Implements the owner's decision for NXT-12. The production prewarm still extracts every source file. Turbopack
singleCsshas to know every style before the CSS is emitted, so the scope stays the same. What changes is that an extraction error during the prewarm no longer fails the build:packages/next-plugin/src/plugin.ts): a file the prewarm cannot extract is skipped, with a warning that names the file and the error:[devup-ui] Turbopack prewarm of <file> failed: <message>. The file is skipped; if Next.js compiles it, the build fails with this error.The file is left out of
prewarmedFilesandprewarmedOutputs. If a route imports it, its loader extracts it through the coordinator and fails the build with the real error. If it is in the route closure (expectedBaseFiles), the base CSS also still waits for it, so no styles are silently lost.packages/webpack-plugin/src/plugin.ts): Next passes the same whole-graph set asproductionPrewarmFiles, and the webpack warm-up used to fail on any extraction error in it. It now warns per file ([devup-ui] webpack stylesheet warm-up of <file> failed: ...) and goes on. Read failures of the complete set still fail the build, as before. The generic warm-up (no complete set) also skips a file it cannot extract, instead of stopping the whole warm-up.Output for valid projects is byte-identical: the new branch runs only when extraction throws (#694).
Left alone
reserveSharedSlots):reserve_class_slots_internalalready drops per-input extraction errors, so they never failed the build.Tests
next-plugin/plugin.test.ts: an unreachable file that throws in prewarm leads to a warning, the build does not throw, files after it still prewarm, and the file is excluded fromprewarmedFilesandprewarmedOutputs.next-plugin/prewarm-error.wasm.test.ts(real WASM + real coordinator + loader): the broken file throwsCannot parse sourcein prewarm extraction and leaves the sheet byte-identical. When the loader compiles the same file, it fails with that real error.webpack-plugin/plugin.test.ts: the complete set skips the broken file with a warning and continues. Read/canonical/numbering errors still propagate. A generic read failure still warns and stops.webpack-plugin/production-prewarm.mjs(real engine):bad.tsxin the complete set warns and later files are still extracted. The loader'scodeExtractofbad.tsxstill throwsCannot parse source.build-errorsexplains the warning. Changepack: next-plugin and webpack-plugin patch.Conflicts
git merge-treeagainstperf/prepass-skip-runtime-package(#1029),perf/reservation-skip-dependency-importsandfix/webpack-rsbuild-graph(#1028) adds no new conflicts. #1029 and #1028 already conflict with main in the same places, and this PR does not touchprewarm.ts.요약
NXT-12에 대한 오너 결정을 구현합니다. 프로덕션 prewarm은 그대로 모든 소스 파일을 추출합니다. Turbopack
singleCss는 CSS를 내보내기 전에 모든 스타일을 알아야 하므로 범위는 바꾸지 않았습니다. 바뀌는 점은 prewarm 단계의 추출 오류가 더 이상 빌드를 실패시키지 않는다는 것입니다.prewarmedFiles/prewarmedOutputs에서 빠집니다. 실제로 import되면 로더가 코디네이터를 통해 다시 추출하고, 실제 오류로 빌드가 실패합니다. 라우트 클로저(expectedBaseFiles)에 있는 파일이면 base CSS도 계속 그 파일을 기다리므로 스타일이 조용히 빠지지 않습니다.productionPrewarmFiles로 넘기며, 기존에는 추출 오류 하나로 빌드가 실패했습니다. 이제 파일 단위로 경고하고 계속 진행합니다. 완전 집합의 읽기 실패는 이전처럼 빌드를 실패시킵니다. 일반 warm-up(완전 집합 없음)도 추출 실패 파일만 건너뜁니다.정상 프로젝트의 출력은 바이트 단위로 동일합니다. 새 분기는 추출이 throw할 때만 실행됩니다(#694).
그대로 둔 것
reserve_class_slots_internal이 이미 입력별 오류를 버리므로 빌드를 실패시킨 적이 없습니다.테스트
Cannot parse source로 실패하고 시트를 바꾸지 않습니다. 같은 파일을 로더가 컴파일하면 실제 오류로 실패합니다.build-errors)와 changepack을 추가했습니다.충돌
#1029,
perf/reservation-skip-dependency-imports, #1028과의git merge-tree에서 새 충돌은 없습니다. #1029와 #1028은 이미 같은 위치에서 main과 충돌하며, 이 PR은prewarm.ts를 건드리지 않습니다.🤖 Generated with Claude Code