Skip to content

Commit

Permalink
Fix loading tasks on Windows (import() URL, not file path) (#421)
Browse files Browse the repository at this point in the history
  • Loading branch information
benjie authored Jan 17, 2024
2 parents 4b75a94 + 1416666 commit 913d4d8
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/plugins/LoadTaskFromJsPlugin.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { GraphileConfig } from "graphile-config";
import { pathToFileURL } from "url";

import { FileDetails, isValidTask } from "../index.js";
import { version } from "../version.js";
Expand Down Expand Up @@ -40,7 +41,7 @@ export const LoadTaskFromJsPlugin: GraphileConfig.Plugin = {
}

try {
const rawMod = await import(jsFile.fullPath);
const rawMod = await import(pathToFileURL(jsFile.fullPath).href);

// Normally, import() of a commonJS module with `module.exports` write
// would result in `{ default: module.exports }`.
Expand Down

0 comments on commit 913d4d8

Please sign in to comment.