Skip to content

Commit

Permalink
Add SSR convention for all components
Browse files Browse the repository at this point in the history
  • Loading branch information
ulasturann committed Sep 27, 2023
1 parent aabbb02 commit 23b3f04
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,15 @@ function addEntry(name, input, output, isComponent = true) {
const external = isComponent ? EXTERNAL_COMPONENT : EXTERNAL;
const inlineDynamicImports = true;

const onwarn = (warning) => {
if (warning.code === 'MODULE_LEVEL_DIRECTIVE') {
return;
}
}

const getEntry = (isMinify) => {
return {
onwarn,
input,
plugins: [...plugins, isMinify && terser(TERSER_PLUGIN_OPTIONS), useCorePlugin && corePlugin()],
external,
Expand All @@ -181,7 +188,8 @@ function addEntry(name, input, output, isComponent = true) {
{
format: 'cjs',
file: `${output}.cjs${isMinify ? '.min' : ''}.js`,
exports
exports,
banner: "'use client';" // This line is required for SSR.
},
{
format: 'esm',
Expand Down

0 comments on commit 23b3f04

Please sign in to comment.