mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-29 01:52:04 +00:00
fix(plugins): fall back to src plugin-sdk aliases
This commit is contained in:
@@ -55,19 +55,15 @@ const resolvePluginSdkAliasFile = (params: {
|
||||
try {
|
||||
const modulePath = params.modulePath ?? fileURLToPath(import.meta.url);
|
||||
const isProduction = process.env.NODE_ENV === "production";
|
||||
const isTest = process.env.VITEST || process.env.NODE_ENV === "test";
|
||||
const normalizedModulePath = modulePath.replace(/\\/g, "/");
|
||||
const isDistRuntime = normalizedModulePath.includes("/dist/");
|
||||
let cursor = path.dirname(modulePath);
|
||||
for (let i = 0; i < 6; i += 1) {
|
||||
const srcCandidate = path.join(cursor, "src", "plugin-sdk", params.srcFile);
|
||||
const distCandidate = path.join(cursor, "dist", "plugin-sdk", params.distFile);
|
||||
const orderedCandidates = isDistRuntime
|
||||
? [distCandidate, srcCandidate]
|
||||
: isProduction
|
||||
? isTest
|
||||
? [distCandidate, srcCandidate]
|
||||
: [distCandidate]
|
||||
const orderedCandidates =
|
||||
isDistRuntime || isProduction
|
||||
? [distCandidate, srcCandidate]
|
||||
: [srcCandidate, distCandidate];
|
||||
for (const candidate of orderedCandidates) {
|
||||
if (fs.existsSync(candidate)) {
|
||||
|
||||
Reference in New Issue
Block a user