Skip to content

Commit

Permalink
more potato
Browse files Browse the repository at this point in the history
  • Loading branch information
kaisermann committed Dec 17, 2023
1 parent d496f42 commit 48b4cdb
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions src/transformers/scss.ts
@@ -1,5 +1,5 @@
import { readFileSync } from 'fs';
import { isAbsolute, join } from 'path';
import { isAbsolute, join, sep } from 'path';

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

Expand Down Expand Up @@ -71,14 +71,23 @@ const transformer: Transformer<Options.Sass> = async ({
// For some reason, scss includes the main 'file' in the array, we don't want that
// Unfortunately I didn't manage to reproduce this in the test env
// More info: https://github.com/sveltejs/svelte-preprocess/issues/346
const absoluteEntryPath = isAbsolute(compiled.stats.entry)
? compiled.stats.entry
: join(process.cwd(), compiled.stats.entry);

// We need to normalize the path for windows, because the sass compiler
// returns a windows path in posix format __just for the entry__ (the dependency list below is fine 🤷)
const normalizedEntryPath =
process.platform === 'win32'
? compiled.stats.entry.split('/').join(sep)
: compiled.stats.entry;

const absoluteEntryPath = isAbsolute(normalizedEntryPath)
? normalizedEntryPath
: join(process.cwd(), normalizedEntryPath);

console.log({
absoluteEntryPath,
absEntry: compiled.stats.entry,
absManual: join(process.cwd(), compiled.stats.entry),
normalizedEntryPath,
absEntry: normalizedEntryPath,
isAbsEntry: isAbsolute(normalizedEntryPath),
absManual: join(process.cwd(), normalizedEntryPath),
included: compiled.stats.includedFiles,
});

Expand Down

0 comments on commit 48b4cdb

Please sign in to comment.