diff --git a/src/index.ts b/src/index.ts index fe4695773..9b8f686db 100644 --- a/src/index.ts +++ b/src/index.ts @@ -233,6 +233,7 @@ export async function build(_options: Options) { ...(options.plugins || []), treeShakingPlugin({ treeshake: options.treeshake, + name: options.globalName }), cjsSplitting(), es5(), diff --git a/src/plugins/tree-shaking.ts b/src/plugins/tree-shaking.ts index 63034f940..c862167e2 100644 --- a/src/plugins/tree-shaking.ts +++ b/src/plugins/tree-shaking.ts @@ -9,8 +9,10 @@ export type TreeshakingStrategy = export const treeShakingPlugin = ({ treeshake, + name }: { - treeshake?: TreeshakingStrategy + treeshake?: TreeshakingStrategy, + name?: string }): Plugin => { return { name: 'tree-shaking', @@ -42,6 +44,7 @@ export const treeShakingPlugin = ({ format: this.format, file: 'out.js', sourcemap: !!this.options.sourcemap, + name }) for (const file of result.output) {