Skip to content

Commit 1971b56

Browse files
authored
fix resolveScript during build (#1069)
1 parent 60e6646 commit 1971b56

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/build.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,11 @@ export async function build(
238238
const r = resolvers.resolveImport(specifier);
239239
const a = aliases.get(resolvePath(path, r));
240240
return a ? relativePath(path, a) : isPathImport(specifier) ? specifier : r; // fallback to specifier if enoent
241+
},
242+
resolveScript(specifier) {
243+
const r = resolvers.resolveScript(specifier);
244+
const a = aliases.get(resolvePath(path, r));
245+
return a ? relativePath(path, a) : specifier; // fallback to specifier if enoent
241246
}
242247
}
243248
});

test/output/build/imports/script.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
<div id="observablehq-center">
3737
<main id="observablehq-main" class="observablehq">
3838
<h1 id="scripts" tabindex="-1"><a class="observablehq-header-anchor" href="#scripts">Scripts</a></h1>
39-
<script src="./_import/top.js?sha=160847a6b4890d59f8e8862911bfbe3b8066955d31f2708cafbe51945c3c57b6" type="module"></script>
39+
<script src="./_import/top.160847a6.js" type="module"></script>
4040
<script src="./_file/top.a53c5d5b.js" type="other"></script>
4141
</main>
4242
<footer id="observablehq-footer">

0 commit comments

Comments
 (0)