We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent aeecd11 commit f6d81d6Copy full SHA for f6d81d6
packages/inference/src/snippets/python.ts
@@ -31,7 +31,10 @@ interface TemplateParams {
31
// Helpers to find + load templates
32
33
const rootDirFinder = (): string => {
34
- let currentPath = path.normalize(import.meta.url).replace("file:", "");
+ let currentPath =
35
+ typeof import.meta !== "undefined" && import.meta.url
36
+ ? path.normalize(new URL(import.meta.url).pathname) /// for ESM
37
+ : __dirname; /// for CJS
38
39
while (currentPath !== "/") {
40
if (pathExists(path.join(currentPath, "package.json"))) {
0 commit comments