-
Notifications
You must be signed in to change notification settings - Fork 30.3k
Fix chunk loading when using __turbopack_load_by_url__ with query #88899
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
base: canary
Are you sure you want to change the base?
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
3db6ee3 to
19ad6a7
Compare
Failing test suitesCommit: 7cfe0f6 | About building and testing Next.js
Expand output● Edge runtime code with imports › Edge API dynamically importing node.js module in a lib › production mode › throws unsupported module error in production at runtime and prints error on logs ● Edge runtime code with imports › Middleware dynamically importing node.js module in a lib › production mode › throws unsupported module error in production at runtime and prints error on logs ● Edge runtime code with imports › Edge API importing vanilla 3rd party module › does not throw in dev at runtime ● Edge runtime code with imports › Edge API importing vanilla 3rd party module › production mode › does not throw in production at runtime ● Edge runtime code with imports › Middleware importing vanilla 3rd party module › does not throw in dev at runtime ● Edge runtime code with imports › Middleware importing vanilla 3rd party module › production mode › does not throw in production at runtime ● Edge runtime code with imports › Edge API using Buffer polyfill › does not throw in dev at runtime ● Edge runtime code with imports › Edge API using Buffer polyfill › production mode › does not throw in production at runtime ● Edge runtime code with imports › Middleware using Buffer polyfill › does not throw in dev at runtime ● Edge runtime code with imports › Middleware using Buffer polyfill › production mode › does not throw in production at runtime
Expand output● Edge runtime configurable guards › Multiple functions with different configurations › warns in dev for allowed code ● Edge runtime configurable guards › Multiple functions with different configurations › warns in dev for unallowed code ● Edge runtime configurable guards › Edge API with allowed, used dynamic code › still warns in dev at runtime ● Edge runtime configurable guards › Middleware with allowed, used dynamic code › still warns in dev at runtime ● Edge runtime configurable guards › Edge API using lib with allowed, used dynamic code › still warns in dev at runtime ● Edge runtime configurable guards › Edge API with use of Function as a type › does not warn in dev at runtime ● Edge runtime configurable guards › Middleware with use of Function as a type › does not warn in dev at runtime
Expand output● Edge runtime code with imports › Edge API statically importing node.js module › throws unsupported module error in dev at runtime and highlights the faulty line ● Edge runtime code with imports › Edge API statically importing node.js module › production mode › throws unsupported module error in production at runtime and prints error on logs ● Edge runtime code with imports › Middleware statically importing node.js module › throws unsupported module error in dev at runtime and highlights the faulty line ● Edge runtime code with imports › Middleware statically importing node.js module › production mode › throws unsupported module error in production at runtime and prints error on logs ● Edge runtime code with imports › Edge API importing unused node.js module › does not throw in dev at runtime ● Edge runtime code with imports › Edge API importing unused node.js module › production mode › does not throw in production at runtime ● Edge runtime code with imports › Middleware importing unused node.js module › does not throw in dev at runtime ● Edge runtime code with imports › Middleware importing unused node.js module › production mode › does not throw in production at runtime
Expand output● Custom Server using HTTP › with middleware $title › should read the expected url protocol in middleware ● Custom Server using HTTPS › with middleware $title › should read the expected url protocol in middleware
Expand output● config telemetry › production mode › detects rewrites, headers, and redirects for next build ● config telemetry › production mode › emits telemetry for usage of ● config telemetry › production mode › emits telemetry for usage of ● config telemetry › production mode › emits telemetry for usage of ● config telemetry › production mode › emits telemetry for usage of middleware ● config telemetry › production mode › emits telemetry for filesystem cache in build mode ● config telemetry › production mode › emits telemetry for isolatedDevBuild enabled by default ● config telemetry › production mode › emits telemetry for isolatedDevBuild disabled
Expand output● Edge runtime code with imports › Edge API dynamically importing node.js module › development mode › throws unsupported module error in dev at runtime and highlights the faulty line ● Edge runtime code with imports › Middleware dynamically importing node.js module › development mode › throws unsupported module error in dev at runtime and highlights the faulty line ● Edge runtime code with imports › Edge API dynamically importing node.js module in a lib › development mode › throws unsupported module error in dev at runtime and highlights the faulty line ● Edge runtime code with imports › Middleware dynamically importing node.js module in a lib › development mode › throws unsupported module error in dev at runtime and highlights the faulty line ● Edge runtime code with imports › Edge API importing vanilla 3rd party module › does not throw in dev at runtime ● Edge runtime code with imports › Middleware importing vanilla 3rd party module › does not throw in dev at runtime ● Edge runtime code with imports › Edge API using Buffer polyfill › does not throw in dev at runtime ● Edge runtime code with imports › Middleware using Buffer polyfill › does not throw in dev at runtime
Expand output● Image Component Default Tests › production mode › should load the images ● Image Component Default Tests › production mode › should preload priority images ● Image Component Default Tests › production mode › should work with preload prop ● Image Component Default Tests › production mode › should not pass through user-provided srcset (causing a flash) ● Image Component Default Tests › production mode › should update the image on src change ● Image Component Default Tests › production mode › should callback onLoadingComplete when image is fully loaded ● Image Component Default Tests › production mode › should callback native onLoad with sythetic event ● Image Component Default Tests › production mode › should callback native onError when error occurred while loading image ● Image Component Default Tests › production mode › should callback native onError even when error before hydration ● Image Component Default Tests › production mode › should work with image with blob src ● Image Component Default Tests › production mode › should work when using flexbox ● Image Component Default Tests › production mode › should work when using overrideSrc prop ● Image Component Default Tests › production mode › should work with sizes and automatically use responsive srcset ● Image Component Default Tests › production mode › should render no wrappers or sizers ● Image Component Default Tests › production mode › should lazy load with placeholder=blur ● Image Component Default Tests › production mode › should handle the styles prop appropriately ● Image Component Default Tests › production mode › should warn when legacy prop layout=fill ● Image Component Default Tests › production mode › should warn when legacy prop layout=responsive ● Image Component Default Tests › production mode › should render picture via getImageProps ● Image Component Default Tests › production mode › should not create an image folder in server/chunks ● Image Component Default Tests › production mode › should render as unoptimized with missing src prop ● Image Component Default Tests › production mode › should render as unoptimized with empty string src prop ● Image Component Default Tests › production mode › should correctly ignore prose styles ● Image Component Default Tests › production mode › should apply style inheritance for img elements but not wrapper elements ● Image Component Default Tests › production mode › should apply filter style after image loads ● Image Component Default Tests › production mode › should emit image for next/dynamic with non ssr case ● Image Component Default Tests › production mode › Fill-mode tests › should include a data-attribute on fill images ● Image Component Default Tests › production mode › Fill-mode tests › should include a data-attribute on fill images ● Image Component Default Tests › production mode › Fill-mode tests › should add position:absolute to fill images ● Image Component Default Tests › production mode › Fill-mode tests › should add position:absolute to fill images ● Image Component Default Tests › production mode › Fill-mode tests › should add 100% width and height to fill images ● Image Component Default Tests › production mode › Fill-mode tests › should add 100% width and height to fill images ● Image Component Default Tests › production mode › Fill-mode tests › should add position styles to fill images ● Image Component Default Tests › production mode › Fill-mode tests › should add position styles to fill images ● Image Component Default Tests › production mode › should correctly rotate image ● Image Component Default Tests › production mode › should create images folder in static/media for edge runtime ● Image Component Default Tests › production mode › should have data url placeholder when enabled ● Image Component Default Tests › production mode › should remove data url placeholder after image loads ● Image Component Default Tests › production mode › should render correct objectFit when data url placeholder and fill ● Image Component Default Tests › production mode › should have blurry placeholder when enabled ● Image Component Default Tests › production mode › should remove blurry placeholder after image loads ● Image Component Default Tests › production mode › should render correct objectFit when blurDataURL and fill ● Image Component Default Tests › production mode › should be valid HTML
Expand output● Image Loader Config with Edge Runtime › development mode › should add "src" to img1 based on the loader config ● Image Loader Config with Edge Runtime › development mode › should add "srcset" to img1 based on the loader config ● Image Loader Config with Edge Runtime › development mode › should add "src" to img2 based on the loader prop ● Image Loader Config with Edge Runtime › development mode › should add "srcset" to img2 based on the loader prop
Expand output● Middleware development errors › when middleware is removed › sends response correctly ● Middleware development errors › when middleware is removed and re-added › sends response correctly ● Middleware development errors › when middleware is added › sends response correctly ● Middleware development errors › when matcher is added › sends response correctly
Expand output● Instrumentation Hook › with-middleware › with-middleware should run the instrumentation hook ● Instrumentation Hook › with-edge-api › with-edge-api should run the instrumentation hook ● Instrumentation Hook › with-edge-page › with-edge-page should run the instrumentation hook ● Instrumentation Hook › with-async-edge-page › with-async-edge-page should run the instrumentation hook
Expand output● app dir - hooks › from pages › should have the correct hooks at /adapter-hooks/static ● app dir - hooks › from pages › should have the correct hooks at /adapter-hooks/1 ● app dir - hooks › from pages › should have the correct hooks at /adapter-hooks/2 ● app dir - hooks › from pages › should have the correct hooks at /adapter-hooks/1/account ● app dir - hooks › from pages › should have the correct hooks at /adapter-hooks/static ● app dir - hooks › from pages › should have the correct hooks at /adapter-hooks/1 ● app dir - hooks › from pages › should have the correct hooks at /adapter-hooks/2 ● app dir - hooks › from pages › should have the correct hooks at /adapter-hooks/1/account ● app dir - hooks › usePathname › should have the correct pathname ● app dir - hooks › usePathname › should have the canonical url pathname on rewrite ● app dir - hooks › useSearchParams › should have the correct search params ● app dir - hooks › useSearchParams › should have the canonical url search params on rewrite ● app dir - hooks › useSearchParams › should be able to use instanceof ReadonlyURLSearchParams ● app dir - hooks › useDraftMode › should use initial rand when draft mode be disabled ● app dir - hooks › useDraftMode › should generate rand when draft mode enabled ● app dir - hooks › useRouter › should allow access to the router ● app dir - hooks › useSelectedLayoutSegments › should have the correct layout segments at /hooks/use-selected-layout-segment/first ● app dir - hooks › useSelectedLayoutSegments › should have the correct layout segments at /hooks/use-selected-layout-segment/first/slug1 ● app dir - hooks › useSelectedLayoutSegments › should have the correct layout segments at /hooks/use-selected-layout-segment/first/slug2/second ● app dir - hooks › useSelectedLayoutSegments › should have the correct layout segments at /hooks/use-selected-layout-segment/first/slug2/second/a/b ● app dir - hooks › useSelectedLayoutSegments › should have the correct layout segments at /hooks/use-selected-layout-segment/rewritten ● app dir - hooks › useSelectedLayoutSegments › should have the correct layout segments at /hooks/use-selected-layout-segment/rewritten-middleware ● app dir - hooks › useSelectedLayoutSegments › should return an empty array in pages ● app dir - hooks › useSelectedLayoutSegment › should have the correct layout segment at /hooks/use-selected-layout-segment/first ● app dir - hooks › useSelectedLayoutSegment › should have the correct layout segment at /hooks/use-selected-layout-segment/first/slug1 ● app dir - hooks › useSelectedLayoutSegment › should have the correct layout segment at /hooks/use-selected-layout-segment/first/slug2/second/a/b ● app dir - hooks › useSelectedLayoutSegment › should return null in pages |
Stats from current PR✅ No significant changes detected📊 All Metrics📖 Metrics GlossaryDev Server Metrics:
Build Metrics:
Change Thresholds:
⚡ Dev Server
📦 Dev Server (Webpack) (Legacy)📦 Dev Server (Webpack)
⚡ Production Builds
📦 Production Builds (Webpack) (Legacy)📦 Production Builds (Webpack)
📦 Bundle SizesBundle Sizes⚡ TurbopackClient Main Bundles: **432 kB** → **432 kB** ✅ -32 B82 files with content-based hashes (individual files not comparable between builds) Server Middleware
Build DetailsBuild Manifests
📦 WebpackClient Main Bundles
Polyfills
Pages
Server Edge SSR
Middleware
Build DetailsBuild Manifests
Build Cache
🔄 Shared (bundler-independent)Runtimes
|
Merging this PR will not alter performance
Comparing Footnotes
|
This reverts commit d70b2d0.
1ba5af3 to
0a673e6
Compare
0a673e6 to
831dfb2
Compare
831dfb2 to
7cfe0f6
Compare
| function getPathFromScript( | ||
| chunkScript: ChunkPath | ChunkListPath | ChunkScript | ChunkListScript | ||
| ): ChunkPath | ChunkListPath { | ||
| if (typeof chunkScript === 'string') { | ||
| return chunkScript as ChunkPath | ChunkListPath | ||
| } | ||
| const chunkUrl = | ||
| typeof TURBOPACK_NEXT_CHUNK_URLS !== 'undefined' | ||
| ? TURBOPACK_NEXT_CHUNK_URLS.pop()! | ||
| : chunkScript.getAttribute('src')! | ||
| const chunkUrl = chunkScript.src! | ||
| const src = decodeURIComponent(chunkUrl.replace(/[?#].*$/, '')) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Happy to report that this also finally removes this stateful .pop call from the seemingly pure function getPathFromScript

await __turbopack_load_by_url__, it waits for the exact chunk url you passed in to loadstripQuery(chunkurl)+CHUNK_SUFFIXso there was mismatch if you load a chunk from a different deployment and thus
await __turbopack_load_by_url__never resolvesVery confused about what's going on here:
In the browser debugger, this line here in
fetchServerResponsenever returns, so there is actually no navigation at all (neither SPA nor MPA) when clicking the link, should be doing an MPA navnext.js/packages/next/src/client/components/router-reducer/fetch-server-response.ts
Line 242 in d4e64f5