Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: ignore rollup warning if silent is true #707

Merged
merged 1 commit into from Oct 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions src/index.ts
Expand Up @@ -234,6 +234,7 @@ export async function build(_options: Options) {
treeShakingPlugin({
treeshake: options.treeshake,
name: options.globalName,
silent: options.silent,
}),
cjsSplitting(),
es5(),
Expand Down
5 changes: 4 additions & 1 deletion src/plugins/tree-shaking.ts
Expand Up @@ -9,10 +9,12 @@ export type TreeshakingStrategy =

export const treeShakingPlugin = ({
treeshake,
name
name,
silent,
}: {
treeshake?: TreeshakingStrategy,
name?: string
silent?: boolean
}): Plugin => {
return {
name: 'tree-shaking',
Expand All @@ -38,6 +40,7 @@ export const treeShakingPlugin = ({
treeshake: treeshake,
makeAbsoluteExternalsRelative: false,
preserveEntrySignatures: 'exports-only',
onwarn: silent ? () => {} : undefined,
})

const result = await bundle.generate({
Expand Down