fix: 编辑器中直接运行example文件报错修复

This commit is contained in:
rnet 2024-03-29 00:39:51 +08:00
parent 30f78974e9
commit cdb4d2a0ef

View File

@ -3,7 +3,7 @@ const fs = require('fs');
const appDirectory = (() => {
// 返回项目根目录
const plist = fs.realpathSync(process.cwd()).split('/');
const plist = fs.realpathSync(__dirname).split('/');
while (!fs.existsSync(path.resolve(plist.join('/'), 'package.json'))) {
plist.pop();
if (plist.length === 0) return false;
@ -17,7 +17,7 @@ module.exports = {
homePath: __dirname,
modulePath: resolveApp('node_modules'),
binPath: resolveApp('node_modules/.bin/'),
package: path.resolve('package.json'),
package: resolveApp('package.json'),
resolve: resolveApp,
handlerPath: resolveApp('handler'),
configPath: resolveApp('config'),