next.js
8996f404 - Turbopack: keep loader source maps when merging modules (#101153)

Commit
1 day ago
Turbopack: keep loader source maps when merging modules (#101153) ## Summary In production builds, Turbopack merges modules into a single output, then composes each module's loader source map into the merged map. It matched each loader map to its module through the map's optional `file` field. Loaders rarely set that field, so their maps were ignored, and stack traces pointed at the loader output instead of the original source. When several modules had maps, their mappings could also mix. Each loader map is now paired with the module it came from and composed one module at a time, so mappings stay with their own module. ## Verification - New e2e test `test/e2e/app-dir/webpack-loader-source-maps` uses a small fixture loader that shifts a module down by 3 lines and returns a source map without `file`. On canary, `pnpm test-start-turbo` fails with both loader-mapped modules reported 3 lines low; with this change it passes. - The same test passes with `pnpm test-dev-turbo`, `pnpm test-start-webpack` and `pnpm test-dev-webpack`. <!-- NEXT_JS_LLM -->
Author
Parents
Loading