Skip to content

Commit c915342

Browse files
authored
fix: filter commonjs plugin when generating declaration (#495)
1 parent 74af8d0 commit c915342

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/builders/rollup/build.ts

+9-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,15 @@ export async function rollupBuild(ctx: BuildContext): Promise<void> {
8383
dts(ctx.options.rollup.dts),
8484
removeShebangPlugin(),
8585
ctx.options.rollup.emitCJS && fixCJSExportTypePlugin(),
86-
].filter(Boolean);
86+
].filter(
87+
(plugin) =>
88+
/**
89+
* Issue: #396
90+
* rollup-plugin-dts conflicts with rollup-plugin-commonjs:
91+
* https://github.com/Swatinem/rollup-plugin-dts?tab=readme-ov-file#what-to-expect
92+
*/
93+
plugin && (!("name" in plugin) || plugin.name !== "commonjs"),
94+
);
8795

8896
await ctx.hooks.callHook("rollup:dts:options", ctx, rollupOptions);
8997
const typesBuild = await rollup(rollupOptions);

0 commit comments

Comments
 (0)