Skip to content

Commit

Permalink
fix(ssr): sourcemap content (fixes #8657) (#8997)
Browse files Browse the repository at this point in the history
  • Loading branch information
sapphi-red committed Jul 10, 2022
1 parent ce790c4 commit aff4544
Show file tree
Hide file tree
Showing 4 changed files with 162 additions and 237 deletions.
2 changes: 1 addition & 1 deletion packages/vite/src/node/server/index.ts
Expand Up @@ -320,7 +320,7 @@ export async function createServer(
ws,
moduleGraph,
ssrTransform(code: string, inMap: SourceMap | null, url: string) {
return ssrTransform(code, inMap, url, {
return ssrTransform(code, inMap, url, code, {
json: { stringify: server.config.json?.stringify }
})
},
Expand Down
3 changes: 2 additions & 1 deletion packages/vite/src/node/server/transformRequest.ts
Expand Up @@ -235,6 +235,7 @@ async function loadAndTransform(
inMap: map,
ssr
})
const originalCode = code
if (
transformResult == null ||
(isObject(transformResult) && transformResult.code == null)
Expand All @@ -258,7 +259,7 @@ async function loadAndTransform(
}

const result = ssr
? await ssrTransform(code, map as SourceMap, url, {
? await ssrTransform(code, map as SourceMap, url, originalCode, {
json: { stringify: !!server.config.json?.stringify }
})
: ({
Expand Down

0 comments on commit aff4544

Please sign in to comment.