mirror of
https://github.com/vitejs/vite.git
synced 2024-11-21 14:48:41 +00:00
fix(css): fix missing source file warning with sass modern api custom importer (#18113)
This commit is contained in:
parent
4cc53224e9
commit
d7763a5615
@ -2300,7 +2300,7 @@ const makeModernScssWorker = (
|
||||
fileURLToPath(canonicalUrl),
|
||||
options.filename,
|
||||
)
|
||||
return { contents, syntax }
|
||||
return { contents, syntax, sourceMapUrl: canonicalUrl }
|
||||
},
|
||||
}
|
||||
sassOptions.importers = [
|
||||
@ -2395,7 +2395,7 @@ const makeModernCompilerScssWorker = (
|
||||
)
|
||||
const contents =
|
||||
result.contents ?? (await fsp.readFile(result.file, 'utf-8'))
|
||||
return { contents, syntax }
|
||||
return { contents, syntax, sourceMapUrl: canonicalUrl }
|
||||
},
|
||||
}
|
||||
sassOptions.importers = [
|
||||
|
@ -139,14 +139,19 @@ describe.runIf(isServe)('serve', () => {
|
||||
expect(formatSourcemapForSnapshot(map)).toMatchInlineSnapshot(`
|
||||
{
|
||||
"ignoreList": [],
|
||||
"mappings": "AACE;EACE",
|
||||
"mappings": "AAGE;EACE,UCJM",
|
||||
"sources": [
|
||||
"/root/imported.sass",
|
||||
"/root/imported-nested.sass",
|
||||
],
|
||||
"sourcesContent": [
|
||||
".imported
|
||||
"@import "/imported-nested.sass"
|
||||
|
||||
.imported
|
||||
&-sass
|
||||
color: red
|
||||
color: $primary
|
||||
",
|
||||
"$primary: red
|
||||
",
|
||||
],
|
||||
"version": 3,
|
||||
|
1
playground/css-sourcemap/imported-nested.sass
Normal file
1
playground/css-sourcemap/imported-nested.sass
Normal file
@ -0,0 +1 @@
|
||||
$primary: red
|
@ -1,3 +1,5 @@
|
||||
@import "/imported-nested.sass"
|
||||
|
||||
.imported
|
||||
&-sass
|
||||
color: red
|
||||
color: $primary
|
||||
|
Loading…
Reference in New Issue
Block a user