|
1 | 1 | import { readFileSync } from 'fs';
|
2 |
| -import { isAbsolute, join } from 'path'; |
| 2 | +import { isAbsolute, join, sep } from 'path'; |
3 | 3 |
|
4 | 4 | import { getIncludePaths, findUp } from '../modules/utils';
|
5 | 5 |
|
@@ -71,14 +71,23 @@ const transformer: Transformer<Options.Sass> = async ({
|
71 | 71 | // For some reason, scss includes the main 'file' in the array, we don't want that
|
72 | 72 | // Unfortunately I didn't manage to reproduce this in the test env
|
73 | 73 | // 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); |
| 74 | + |
| 75 | + // We need to normalize the path for windows, because the sass compiler |
| 76 | + // returns a windows path in posix format __just for the entry__ (the dependency list below is fine 🤷) |
| 77 | + const normalizedEntryPath = |
| 78 | + process.platform === 'win32' |
| 79 | + ? compiled.stats.entry.split('/').join(sep) |
| 80 | + : compiled.stats.entry; |
| 81 | + |
| 82 | + const absoluteEntryPath = isAbsolute(normalizedEntryPath) |
| 83 | + ? normalizedEntryPath |
| 84 | + : join(process.cwd(), normalizedEntryPath); |
77 | 85 |
|
78 | 86 | console.log({
|
79 |
| - absoluteEntryPath, |
80 |
| - absEntry: compiled.stats.entry, |
81 |
| - absManual: join(process.cwd(), compiled.stats.entry), |
| 87 | + normalizedEntryPath, |
| 88 | + absEntry: normalizedEntryPath, |
| 89 | + isAbsEntry: isAbsolute(normalizedEntryPath), |
| 90 | + absManual: join(process.cwd(), normalizedEntryPath), |
82 | 91 | included: compiled.stats.includedFiles,
|
83 | 92 | });
|
84 | 93 |
|
|
0 commit comments