Skip to content

Commit 69d1992

Browse files
committed
Follow old path specification method according to review flydelabs#120
1 parent 8e11fe8 commit 69d1992

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

resolver/src/resolver/resolve-dependencies/macro-node-to-definition.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import {
33
MacroNode,
44
MacroNodeDefinition,
55
} from "@flyde/core";
6-
import { readFileSync } from "fs";
6+
import { readFileSync, existsSync } from "fs";
77
import { join } from "path";
88

99
export function macroNodeToDefinition<T>(
@@ -21,11 +21,20 @@ export function macroNodeToDefinition<T>(
2121
editorComponentBundleContent: "",
2222
} as MacroEditorConfigCustomDefinition,
2323
};
24-
const editorComponentPath = join(
25-
importPath,
24+
const BundlePathPlusOne = join(
2625
"..",
2726
macro.editorConfig.editorComponentBundlePath,
2827
);
28+
let editorComponentPath = join(
29+
importPath,
30+
BundlePathPlusOne,
31+
);
32+
if (!existsSync(editorComponentPath)) {
33+
editorComponentPath = join(
34+
importPath,
35+
macro.editorConfig.editorComponentBundlePath,
36+
)
37+
}
2938

3039
try {
3140
const content = readFileSync(editorComponentPath, "utf8");

0 commit comments

Comments
 (0)