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" "nocobase-build": "./bin/nocobase-build.js"
}, },
"scripts": { "scripts": {
"build": "tsup" "build": "tsup",
"prepare": "tsup"
}, },
"dependencies": { "dependencies": {
"@babel/core": "7.22.10", "@babel/core": "7.22.10",

View File

@ -16,10 +16,12 @@ import {
readFileSync, readFileSync,
writeFileSync as _writeFileSync, writeFileSync as _writeFileSync,
} from 'fs'; } from 'fs';
import { createRequire } from 'module';
const require = createRequire(import.meta.url);
export function isPackageValid(pkg: string) { export function isPackageValid(pkg: string) {
try { try {
import.meta.resolve(join(process.cwd(), pkg)); require(pkg)
return true; return true;
} catch (error) { } catch (error) {
return false; return false;