feat: enhance Rollup configuration for client package

- Updated terser plugin settings to preserve directives like 'use client'.
- Added custom warning handler to ignore "use client" directive warnings during the build process.
This commit is contained in:
Danny Avila 2025-07-13 08:44:35 -04:00 committed by Marco Beretta
parent f8738b207c
commit b6c7b0bc71
No known key found for this signature in database
GPG key ID: D918033D8E74CC11

View file

@ -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);
},
};