diff --git a/scripts/copy-bundled-plugin-metadata.mjs b/scripts/copy-bundled-plugin-metadata.mjs index 12211f9b29b..ea833bda43b 100644 --- a/scripts/copy-bundled-plugin-metadata.mjs +++ b/scripts/copy-bundled-plugin-metadata.mjs @@ -1,6 +1,7 @@ import fs from "node:fs"; import path from "node:path"; import { pathToFileURL } from "node:url"; +import { shouldBuildBundledCluster } from "./lib/optional-bundled-clusters.mjs"; import { removeFileIfExists, removePathIfExists, @@ -176,6 +177,11 @@ export function copyBundledPluginMetadata(params = {}) { if (!dirent.isDirectory()) { continue; } + // Skip optional bundled clusters that are not included in this build. + // This matches the filtering logic in tsdown.config.ts. + if (!shouldBuildBundledCluster(dirent.name, process.env)) { + continue; + } sourcePluginDirs.add(dirent.name); const pluginDir = path.join(extensionsRoot, dirent.name);