From d1217a286e1dea62cc398e83c52b3a4bcf973554 Mon Sep 17 00:00:00 2001 From: vanpipy Date: Fri, 6 Nov 2020 00:02:15 +0800 Subject: [PATCH] fix: add current working directory to avoid the module cannnot be found --- packages/core/src/bin/mocker.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/core/src/bin/mocker.ts b/packages/core/src/bin/mocker.ts index 05a05dec..9c5f10a5 100755 --- a/packages/core/src/bin/mocker.ts +++ b/packages/core/src/bin/mocker.ts @@ -14,9 +14,10 @@ interface MockerConfig extends MockerOption { port: number; } -const DEFAULT_MOCKER_CONFIG_PATH = './mocker.config.json'; +const CWD = process.cwd(); +const PKG_PATH = path.resolve(CWD, './package.json'); +const DEFAULT_MOCKER_CONFIG_PATH = path.resolve(CWD, './mocker.config.json'); const DEFAULT_MOCK_PATH = ['./mock']; -const PKG_PATH = './package.json'; const DEFAULT_CONFIG: MockerConfig = { host: '0.0.0.0', port: 3721