Skip to content

Commit

Permalink
Fix importing the same file without returning file
Browse files Browse the repository at this point in the history
  • Loading branch information
ntkme committed Aug 1, 2024
1 parent fbdc63b commit bd76675
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/src/legacy/importer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ export class LegacyFileImporterWrapper<sync extends 'sync' | 'async'>
* new-API `Importer` and `FileImporter`.
*/
export class LegacyImportersWrapper<sync extends 'sync' | 'async'> {
private id = 0;
private importerResult?: ImporterResult;
private fileUrl?: URL;

Expand Down Expand Up @@ -130,6 +131,9 @@ export class LegacyImportersWrapper<sync extends 'sync' | 'async'> {
? (result as {file: string}).file
: p.join(p.dirname(parentPath), path)
);
if (!('file' in result)) {
canonicalUrl.searchParams.set('id', '' + this.id++);
}
this.importerResult = {
contents: result.contents || '',
syntax: canonicalUrl.pathname.endsWith('.sass')
Expand Down

0 comments on commit bd76675

Please sign in to comment.