Skip to content

Commit

Permalink
fix: pass globalName to rollup for tree-shaking iife build (#692)
Browse files Browse the repository at this point in the history
  • Loading branch information
imranbarbhuiya committed Aug 26, 2022
1 parent 7000c8b commit 900a260
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/index.ts
Expand Up @@ -233,6 +233,7 @@ export async function build(_options: Options) {
...(options.plugins || []),
treeShakingPlugin({
treeshake: options.treeshake,
name: options.globalName
}),
cjsSplitting(),
es5(),
Expand Down
5 changes: 4 additions & 1 deletion src/plugins/tree-shaking.ts
Expand Up @@ -9,8 +9,10 @@ export type TreeshakingStrategy =

export const treeShakingPlugin = ({
treeshake,
name
}: {
treeshake?: TreeshakingStrategy
treeshake?: TreeshakingStrategy,
name?: string
}): Plugin => {
return {
name: 'tree-shaking',
Expand Down Expand Up @@ -42,6 +44,7 @@ export const treeShakingPlugin = ({
format: this.format,
file: 'out.js',
sourcemap: !!this.options.sourcemap,
name
})

for (const file of result.output) {
Expand Down

0 comments on commit 900a260

Please sign in to comment.