fix: build

This commit is contained in:
sealday 2024-04-13 03:25:36 +08:00
parent fa91538581
commit 690a275f1a
2 changed files with 5 additions and 2 deletions

View File

@ -10,7 +10,8 @@
"nocobase-build": "./bin/nocobase-build.js"
},
"scripts": {
"build": "tsup"
"build": "tsup",
"prepare": "tsup"
},
"dependencies": {
"@babel/core": "7.22.10",

View File

@ -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;