From efa0e75a065e90ed1c006f5e6be7fbeab0e8bce4 Mon Sep 17 00:00:00 2001 From: yiling Date: Sat, 20 Jun 2026 14:39:43 +0800 Subject: [PATCH] fix(release): bundle zod for shumai webapp and keep it external for workers --- scripts/build-npm.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/scripts/build-npm.ts b/scripts/build-npm.ts index a9ecf3bf..467d663d 100644 --- a/scripts/build-npm.ts +++ b/scripts/build-npm.ts @@ -165,6 +165,7 @@ async function buildPlatformPackages( entrypoint: string, // eslint-disable-next-line @typescript-eslint/no-explicit-any plugins: any[] = [], + external?: string[], ) { for (const target of targets) { const dirName = `${appName}-${target.platform}-${target.arch}` @@ -180,6 +181,7 @@ async function buildPlatformPackages( binaryName, bunTarget: target.bunTarget, plugins, + external, }) // Generate package.json for platform-specific package @@ -209,6 +211,7 @@ async function buildMainPackage({ entrypoint, plugins = [], extraDependencies = {}, + external = commonExternal, }: { appName: string description: string @@ -217,6 +220,7 @@ async function buildMainPackage({ // eslint-disable-next-line @typescript-eslint/no-explicit-any plugins?: any[] extraDependencies?: Record + external?: string[] }) { console.log(`\nšŸ“„ Packaging wrapper app ${appName}...`) const mainOutDir = path.join(distDir, appName) @@ -235,7 +239,7 @@ async function buildMainPackage({ minify: true, naming: `${appName}-app.[ext]`, plugins, - external: commonExternal, + external, define: { 'process.env.NODE_ENV': JSON.stringify('production'), }, @@ -489,13 +493,15 @@ const shumaiPlugins = [ }), tailwindPlugin, ] -await buildPlatformPackages('shumai', dummyRunnerPath) +const shumaiExternal = commonExternal.filter((dep) => dep !== 'zod') +await buildPlatformPackages('shumai', dummyRunnerPath, shumaiPlugins, shumaiExternal) await buildMainPackage({ appName: 'shumai', description: 'A fullstack AI-powered media workspace and workflow engine', hasPrisma: true, entrypoint: './apps/web/src/index.ts', plugins: shumaiPlugins, + external: shumaiExternal, }) // 3. Build shumai-agent (Agent app & platform binaries)