From 1971b567b103d948fa51c8c1ced72407c768fa05 Mon Sep 17 00:00:00 2001 From: Mike Bostock Date: Fri, 15 Mar 2024 09:03:03 -0700 Subject: [PATCH] fix resolveScript during build (#1069) --- src/build.ts | 5 +++++ test/output/build/imports/script.html | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/build.ts b/src/build.ts index b1b88718f..52fdc7697 100644 --- a/src/build.ts +++ b/src/build.ts @@ -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 } } }); diff --git a/test/output/build/imports/script.html b/test/output/build/imports/script.html index 510ccd227..cfd0511db 100644 --- a/test/output/build/imports/script.html +++ b/test/output/build/imports/script.html @@ -36,7 +36,7 @@

Scripts

- +