Skip to content

Commit

Permalink
Fix dynamic import
Browse files Browse the repository at this point in the history
  • Loading branch information
nktpro committed Oct 9, 2024
1 parent ec38350 commit 3a523d3
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { fsExists, gray, inheritExec, joinPath, red, stringifyYaml } from "./dep
import type { InstanceConfig } from "./types.ts";
import { AgentInstanceConfigSchema, JoinMetadataSchema, ServerInstanceConfigSchema } from "./types.ts";
import cloudInitScripts from "./cloud_init_scripts.json" with { type: "json" };
import { toFileUrl } from "@std/path/to-file-url";

function renderValidationError(error: ValueError) {
return ` - at path ${JSON.stringify(error.path)}: ${error.message}`;
Expand Down Expand Up @@ -36,7 +37,7 @@ export async function loadInstanceConfig(

log(gray(`Importing instance config ${instancePath}`));

const instanceMod = await import(instancePath);
const instanceMod = await import(toFileUrl(instancePath).toString());

if (!instanceMod.default) {
throw new Error("Instance config module does not have a default export");
Expand Down

0 comments on commit 3a523d3

Please sign in to comment.