Skip to content

Commit

Permalink
fix: only include "use client" banner in ESM builds (#891)
Browse files Browse the repository at this point in the history
  • Loading branch information
Yonom authored Sep 26, 2024
1 parent 9bd13b7 commit 27208fb
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 16 deletions.
8 changes: 8 additions & 0 deletions .changeset/six-pants-compete.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
"@assistant-ui/react-playground": patch
"@tool-ui/weather": patch
"@assistant-ui/react-markdown": patch
"@assistant-ui/react": patch
---

fix: only include "use client" banner in ESM builds
10 changes: 6 additions & 4 deletions packages/react-markdown/scripts/build.mts
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@ await build({
dts: true,
sourcemap: true,
clean: true,
esbuildOptions: (options) => {
options.banner = {
js: '"use client";\n',
};
esbuildOptions: (options, { format }) => {
if (format === "esm") {
options.banner = {
js: '"use client";',
};
}
},
});

Expand Down
10 changes: 6 additions & 4 deletions packages/react-playground/scripts/build.mts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@ await build({
dts: true,
sourcemap: true,
clean: true,
esbuildOptions: (options) => {
options.banner = {
js: '"use client";\n',
};
esbuildOptions: (options, { format }) => {
if (format === "esm") {
options.banner = {
js: '"use client";',
};
}
},
});

Expand Down
10 changes: 6 additions & 4 deletions packages/react/scripts/build.mts
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@ await build({
sourcemap: true,
clean: true,
splitting: true,
esbuildOptions: (options) => {
options.banner = {
js: '"use client";\n',
};
esbuildOptions: (options, { format }) => {
if (format === "esm") {
options.banner = {
js: '"use client";',
};
}
},
});

Expand Down
10 changes: 6 additions & 4 deletions packages/tool-ui-weather/scripts/build.mts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@ await build({
dts: true,
sourcemap: true,
clean: true,
esbuildOptions: (options) => {
options.banner = {
js: '"use client";\n',
};
esbuildOptions: (options, { format }) => {
if (format === "esm") {
options.banner = {
js: '"use client";',
};
}
},
});

0 comments on commit 27208fb

Please sign in to comment.