diff --git a/packages/pkg/CHANGELOG.md b/packages/pkg/CHANGELOG.md index 0e6a954d..e3e0da54 100644 --- a/packages/pkg/CHANGELOG.md +++ b/packages/pkg/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## 1.5.13 + +### Patch Changes + +- 1de94aa: feat: support modify vendor name + ## 1.5.12 ### Patch Changes diff --git a/packages/pkg/package.json b/packages/pkg/package.json index 09a40b2a..07e3705a 100644 --- a/packages/pkg/package.json +++ b/packages/pkg/package.json @@ -1,6 +1,6 @@ { "name": "@ice/pkg", - "version": "1.5.12", + "version": "1.5.13", "description": "A fast builder for React components, Node modules and web libraries.", "type": "module", "main": "./lib/index.js", diff --git a/packages/pkg/src/helpers/getRollupOptions.ts b/packages/pkg/src/helpers/getRollupOptions.ts index a1cbc9b1..a4166252 100644 --- a/packages/pkg/src/helpers/getRollupOptions.ts +++ b/packages/pkg/src/helpers/getRollupOptions.ts @@ -165,12 +165,13 @@ function getRollupOutputs({ esVersion, command, }: GetRollupOutputsOptions): OutputOptions[] { - const { outputDir } = bundleTaskConfig; + const { outputDir, vendorName = 'vendor' } = bundleTaskConfig; const outputFormats = (bundleTaskConfig.formats || []).filter((format) => format !== 'es2017') as Array<'umd' | 'esm' | 'cjs'>; const name = bundleTaskConfig.name ?? pkg.name; const minify = bundleTaskConfig.jsMinify(mode, command); + return outputFormats.map((format) => ({ name, format, @@ -183,7 +184,7 @@ function getRollupOutputs({ chunkFileNames: getFilename('[name]', format, esVersion, mode, 'js'), manualChunks: format !== 'umd' ? (id, { getModuleInfo }) => { if (/node_modules/.test(id)) { - return 'vendor'; + return vendorName; } const entryPoints = []; @@ -204,7 +205,7 @@ function getRollupOutputs({ } // For multiple entries, we put it into a "shared code" bundle if (entryPoints.length > 1) { - return 'vendor'; + return vendorName; } } : undefined, plugins: [ diff --git a/packages/pkg/src/types.ts b/packages/pkg/src/types.ts index 5d239d94..8c74318d 100644 --- a/packages/pkg/src/types.ts +++ b/packages/pkg/src/types.ts @@ -218,6 +218,8 @@ export interface BundleTaskConfig extends jsMinify?: (mode: string, command: string) => JSMinify; cssMinify?: (mode: string, command: string) => CSSMinify; + + vendorName?: string; } export interface TransformTaskConfig extends _TaskConfig, TransformUserConfig {