Skip to content

Commit

Permalink
Fix use client directive banner applying to universal module export (
Browse files Browse the repository at this point in the history
…#28)

* fix: only have 'use client' banner on client module export

* ci(changesets): add changeset for 'use client' directive fix
  • Loading branch information
coopbri authored Aug 7, 2023
1 parent b9b66ea commit 5d4641c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/tender-carrots-destroy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@animareflection/ui": patch
---

Fix `use client` directive banner applying to both client and universal export
2 changes: 2 additions & 0 deletions src/index.client.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
"use client";

// export components renderable on client
export * from "components/client";
3 changes: 1 addition & 2 deletions tsup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,13 @@ import { defineConfig as defineTsupConfig } from "tsup";
*/
const tsupConfig = defineTsupConfig({
entry: { ui: "src/index.ts", client: "src/index.client.ts" },
// TODO enable Rollup tree-shaking, temporarily disabled to allow properly injecting `use client` directive banner; track https://github.com/egoist/tsup/issues/835
// TODO enable Rollup tree-shaking, temporarily disabled to allow properly injecting `use client` directive banner (Rollup tree-shaking removes it); track https://github.com/egoist/tsup/issues/835
// treeshake: true,
sourcemap: true,
minify: true,
clean: true,
dts: true,
splitting: false,
banner: { js: `"use client";\n` },
format: ["cjs", "esm"],
external: ["react", "@ark-ui/react"],
outDir: "build",
Expand Down

1 comment on commit 5d4641c

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverage report

St.
Category Percentage Covered / Total
🟢 Statements 100% 57/57
🟢 Branches 100% 0/0
🟢 Functions 100% 0/0
🟢 Lines 100% 57/57

Test suite run success

2 tests passing in 2 suites.

Report generated by 🧪jest coverage report action from 5d4641c

Please sign in to comment.