From 690a275f1a2ac7f45e97bc4df7aaf3157b507dd5 Mon Sep 17 00:00:00 2001 From: sealday Date: Sat, 13 Apr 2024 03:25:36 +0800 Subject: [PATCH] fix: build --- packages/core/build/package.json | 3 ++- packages/core/cli/src/util.ts | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/core/build/package.json b/packages/core/build/package.json index b0604d60b..5751b6b80 100755 --- a/packages/core/build/package.json +++ b/packages/core/build/package.json @@ -10,7 +10,8 @@ "nocobase-build": "./bin/nocobase-build.js" }, "scripts": { - "build": "tsup" + "build": "tsup", + "prepare": "tsup" }, "dependencies": { "@babel/core": "7.22.10", diff --git a/packages/core/cli/src/util.ts b/packages/core/cli/src/util.ts index ac1313f61..8443365bb 100644 --- a/packages/core/cli/src/util.ts +++ b/packages/core/cli/src/util.ts @@ -16,10 +16,12 @@ import { readFileSync, writeFileSync as _writeFileSync, } from 'fs'; +import { createRequire } from 'module'; +const require = createRequire(import.meta.url); export function isPackageValid(pkg: string) { try { - import.meta.resolve(join(process.cwd(), pkg)); + require(pkg) return true; } catch (error) { return false;