diff --git a/packages/client/rollup.config.js b/packages/client/rollup.config.js index 1a756b9de2..fd2578e0cd 100644 --- a/packages/client/rollup.config.js +++ b/packages/client/rollup.config.js @@ -31,7 +31,11 @@ const plugins = [ useTsconfigDeclarationDir: true, clean: true, }), - terser(), + terser({ + compress: { + directives: false, // Preserve directives like 'use client' + }, + }), ]; export default { @@ -53,4 +57,11 @@ export default { external: [...Object.keys(pkg.peerDependencies || {}), 'react/jsx-runtime'], preserveSymlinks: true, plugins, + onwarn(warning, warn) { + // Ignore "use client" directive warnings + if (warning.code === 'MODULE_LEVEL_DIRECTIVE') { + return; + } + warn(warning); + }, };