Skip to content

Commit 209c3bd

Browse files
authoredMar 1, 2023
fix: avoid null sourcePath in server.sourcemapIgnoreList (#12251)
1 parent 9885f6f commit 209c3bd

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed
 

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

+2-5
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,7 @@ async function loadAndTransform(
277277
++sourcesIndex
278278
) {
279279
const sourcePath = map.sources[sourcesIndex]
280+
if (!sourcePath) continue
280281

281282
const sourcemapPath = `${mod.file}.map`
282283
const ignoreList = config.server.sourcemapIgnoreList(
@@ -298,11 +299,7 @@ async function loadAndTransform(
298299
// Rewrite sources to relative paths to give debuggers the chance
299300
// to resolve and display them in a meaningful way (rather than
300301
// with absolute paths).
301-
if (
302-
sourcePath &&
303-
path.isAbsolute(sourcePath) &&
304-
path.isAbsolute(mod.file)
305-
) {
302+
if (path.isAbsolute(sourcePath) && path.isAbsolute(mod.file)) {
306303
map.sources[sourcesIndex] = path.relative(
307304
path.dirname(mod.file),
308305
sourcePath,

0 commit comments

Comments
 (0)
Please sign in to comment.