Skip to content

Commit ee78cec

Browse files
committed
feat: make sourcemap work at full bundle mode dev
1 parent 603e229 commit ee78cec

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

packages/vite/src/node/build.ts

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -974,13 +974,16 @@ async function buildEnvironment(
974974
return
975975
}
976976

977-
if (hmrOutput.patch) {
978-
const url = `${Date.now()}.js`
979-
server!.memoryFiles[url] = hmrOutput.patch
977+
if (hmrOutput.code) {
978+
server!.memoryFiles[hmrOutput.filename] = hmrOutput.code
979+
if (hmrOutput.sourcemap) {
980+
server!.memoryFiles[hmrOutput.sourcemapFilename] =
981+
hmrOutput.sourcemap
982+
}
980983
const updates = hmrOutput.hmrBoundaries.map((boundary: any) => {
981984
return {
982985
type: 'js-update',
983-
url,
986+
url: hmrOutput.filename,
984987
path: boundary.boundary,
985988
acceptedPath: boundary.acceptedVia,
986989
firstInvalidatedBy: hmrOutput.firstInvalidatedBy,
@@ -1026,7 +1029,7 @@ async function buildEnvironment(
10261029

10271030
await handleHmrOutput(hmrOutput, file)
10281031

1029-
if (hmrOutput.patch) {
1032+
if (hmrOutput.code) {
10301033
debounceBuild()
10311034
}
10321035
})
@@ -1050,7 +1053,7 @@ async function buildEnvironment(
10501053
)
10511054
await handleHmrOutput(hmrOutput, file)
10521055

1053-
if (hmrOutput.patch) {
1056+
if (hmrOutput.code) {
10541057
debounceBuild()
10551058
}
10561059
}

0 commit comments

Comments
 (0)