Skip to content

Commit

Permalink
Fix resolving relative url
Browse files Browse the repository at this point in the history
  • Loading branch information
ntkme committed Apr 3, 2024
1 parent 03934e2 commit 16e615f
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 10 deletions.
2 changes: 1 addition & 1 deletion lib/src/legacy/importer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ export class LegacyImporterWrapper<sync extends 'sync' | 'async'>
}
}

return null;
url = urlWithoutPrefix;
}

const prev = this.prev[this.prev.length - 1];
Expand Down
9 changes: 0 additions & 9 deletions lib/src/legacy/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ import {
LegacyStringOptions,
Options,
StringOptions,
Importer,
FileImporter,
} from '../vendor/sass';
import {wrapFunction} from './value/wrap';
import {endOfLoadProtocol, LegacyImporterWrapper} from './importer';
Expand Down Expand Up @@ -184,20 +182,13 @@ function convertStringOptions<sync extends 'sync' | 'async'>(
): StringOptions<sync> & {legacy: true} {
const modernOptions = convertOptions(options, sync);

// Find the first non-NodePackageImporter to pass as legacy `importer` option.
// NodePackageImporter will be passed in `modernOptions.importers`.
const importer = modernOptions.importers?.find(
_importer => !(_importer instanceof NodePackageImporter)
) as Importer<sync> | FileImporter<sync>;

return {
...modernOptions,
url: options.file
? options.importer
? pathToLegacyFileUrl(options.file)
: pathToFileURL(options.file)
: new URL(legacyImporterProtocol),
importer,
syntax: options.indentedSyntax ? 'indented' : 'scss',
};
}
Expand Down

0 comments on commit 16e615f

Please sign in to comment.