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;