diff --git a/src/render.ts b/src/render.ts index 926f24e19..4b2f2efe3 100644 --- a/src/render.ts +++ b/src/render.ts @@ -59,7 +59,7 @@ if (location.pathname.endsWith("/")) { import ${preview || page.code.length ? `{${preview ? "open, " : ""}define} from ` : ""}${JSON.stringify( resolveImport("observablehq:client") )};${ - files.size || data?.sql + files.size ? `\nimport {registerFile${data?.sql ? ", FileAttachment" : ""}} from ${JSON.stringify( resolveImport("observablehq:stdlib") )};` diff --git a/src/resolvers.ts b/src/resolvers.ts index 7f473607b..7b1a857f0 100644 --- a/src/resolvers.ts +++ b/src/resolvers.ts @@ -123,8 +123,11 @@ export async function getResolvers( // Add SQL sources. if (page.data.sql) { - for (const source of Object.values(page.data.sql)) { - files.add(String(source)); + for (const value of Object.values(page.data.sql)) { + const source = String(value); + if (isAssetPath(source)) { + files.add(source); + } } }