Skip to content

Commit acd2c41

Browse files
committed
feat: make sourcemap work at full bundle mode dev
1 parent 80f53db commit acd2c41

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
@@ -975,13 +975,16 @@ async function buildEnvironment(
975975
return
976976
}
977977

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

10281031
await handleHmrOutput(hmrOutput, file)
10291032

1030-
if (hmrOutput.patch) {
1033+
if (hmrOutput.code) {
10311034
debounceBuild()
10321035
}
10331036
})
@@ -1051,7 +1054,7 @@ async function buildEnvironment(
10511054
)
10521055
await handleHmrOutput(hmrOutput, file)
10531056

1054-
if (hmrOutput.patch) {
1057+
if (hmrOutput.code) {
10551058
debounceBuild()
10561059
}
10571060
}

0 commit comments

Comments
 (0)