Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 209312f

Browse filesBrowse files
authored
fix: sass dependency list referencing source file in win32 (#621)
1 parent 7f42697 commit 209312f
Copy full SHA for 209312f

File tree

Expand file treeCollapse file tree

2 files changed

+14
-6
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+14
-6
lines changed

‎package.json

Copy file name to clipboardExpand all lines: package.json
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
},
2424
"packageManager": "pnpm@8.12.1",
2525
"volta": {
26-
"node": "14.19.2"
26+
"node": "20.10.0"
2727
},
2828
"files": [
2929
"dist/"

‎src/transformers/scss.ts

Copy file name to clipboardExpand all lines: src/transformers/scss.ts
+13-5Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { readFileSync } from 'fs';
2-
import { isAbsolute, join } from 'path';
2+
import path from 'path';
33

44
import { getIncludePaths, findUp } from '../modules/utils';
55

@@ -19,7 +19,7 @@ const tildeImporter: LegacySyncImporter = (url, prev) => {
1919
prev = decodeURIComponent(prev);
2020
}
2121

22-
const modulePath = join('node_modules', ...url.slice(1).split(/[\\/]/g));
22+
const modulePath = path.join('node_modules', ...url.slice(1).split(/[\\/]/g));
2323

2424
const foundPath = findUp({ what: modulePath, from: prev });
2525

@@ -68,12 +68,20 @@ const transformer: Transformer<Options.Sass> = async ({
6868

6969
const compiled = renderSync(sassOptions);
7070

71+
// We need to normalize the path for windows, because the sass compiler
72+
// returns a windows path in posix format __just for the entry__ (the dependency list below is fine 🤷)
73+
// More info: https://github.com/sveltejs/svelte-preprocess/issues/619
74+
const normalizedEntryPath =
75+
process.platform === 'win32'
76+
? compiled.stats.entry.split('/').join(path.win32.sep)
77+
: compiled.stats.entry;
78+
7179
// For some reason, scss includes the main 'file' in the array, we don't want that
7280
// Unfortunately I didn't manage to reproduce this in the test env
7381
// More info: https://github.com/sveltejs/svelte-preprocess/issues/346
74-
const absoluteEntryPath = isAbsolute(compiled.stats.entry)
75-
? compiled.stats.entry
76-
: join(process.cwd(), compiled.stats.entry);
82+
const absoluteEntryPath = path.isAbsolute(normalizedEntryPath)
83+
? normalizedEntryPath
84+
: path.join(process.cwd(), normalizedEntryPath);
7785

7886
const processed = {
7987
code: compiled.css.toString(),

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.