From 6950bc169fccb7abc2e0faaaf06a72427772477f Mon Sep 17 00:00:00 2001 From: anubra266 Date: Thu, 25 Jan 2024 10:51:28 -0600 Subject: [PATCH] Fix CLI issue --- plugin/src/utils/index.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugin/src/utils/index.ts b/plugin/src/utils/index.ts index 2d6f0f2..9952057 100644 --- a/plugin/src/utils/index.ts +++ b/plugin/src/utils/index.ts @@ -10,7 +10,8 @@ export const createRule: ReturnType<(typeof ESLintUtils)['RuleCreator']> = ESLin export type Rule = ReturnType> -export const distDir = fileURLToPath(new URL(process.env.MODE === 'test' ? '../../dist' : './', import.meta.url)) +const isBase = process.env.NODE_ENV !== 'test' || import.meta.url.endsWith('dist/index.js') +export const distDir = fileURLToPath(new URL(isBase ? './' : '../../dist', import.meta.url)) export const syncAction = createSyncFn(join(distDir, 'utils/worker.mjs')) as typeof run