Skip to content

Commit

Permalink
fix resolveScript during build (#1069)
Browse files Browse the repository at this point in the history
  • Loading branch information
mbostock authored Mar 15, 2024
1 parent 60e6646 commit 1971b56
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,11 @@ export async function build(
const r = resolvers.resolveImport(specifier);
const a = aliases.get(resolvePath(path, r));
return a ? relativePath(path, a) : isPathImport(specifier) ? specifier : r; // fallback to specifier if enoent
},
resolveScript(specifier) {
const r = resolvers.resolveScript(specifier);
const a = aliases.get(resolvePath(path, r));
return a ? relativePath(path, a) : specifier; // fallback to specifier if enoent
}
}
});
Expand Down
2 changes: 1 addition & 1 deletion test/output/build/imports/script.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
<div id="observablehq-center">
<main id="observablehq-main" class="observablehq">
<h1 id="scripts" tabindex="-1"><a class="observablehq-header-anchor" href="#scripts">Scripts</a></h1>
<script src="./_import/top.js?sha=160847a6b4890d59f8e8862911bfbe3b8066955d31f2708cafbe51945c3c57b6" type="module"></script>
<script src="./_import/top.160847a6.js" type="module"></script>
<script src="./_file/top.a53c5d5b.js" type="other"></script>
</main>
<footer id="observablehq-footer">
Expand Down

0 comments on commit 1971b56

Please sign in to comment.