Skip to content

Commit aff4544

Browse files
authored
fix(ssr): sourcemap content (fixes #8657) (#8997)
1 parent ce790c4 commit aff4544

File tree

4 files changed

+162
-237
lines changed

4 files changed

+162
-237
lines changed

packages/vite/src/node/server/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ export async function createServer(
320320
ws,
321321
moduleGraph,
322322
ssrTransform(code: string, inMap: SourceMap | null, url: string) {
323-
return ssrTransform(code, inMap, url, {
323+
return ssrTransform(code, inMap, url, code, {
324324
json: { stringify: server.config.json?.stringify }
325325
})
326326
},

packages/vite/src/node/server/transformRequest.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,7 @@ async function loadAndTransform(
235235
inMap: map,
236236
ssr
237237
})
238+
const originalCode = code
238239
if (
239240
transformResult == null ||
240241
(isObject(transformResult) && transformResult.code == null)
@@ -258,7 +259,7 @@ async function loadAndTransform(
258259
}
259260

260261
const result = ssr
261-
? await ssrTransform(code, map as SourceMap, url, {
262+
? await ssrTransform(code, map as SourceMap, url, originalCode, {
262263
json: { stringify: !!server.config.json?.stringify }
263264
})
264265
: ({

0 commit comments

Comments
 (0)