Skip to content

Commit

Permalink
feat: add cjs target
Browse files Browse the repository at this point in the history
  • Loading branch information
amrbashir committed Feb 3, 2023
1 parent 3f64f6b commit add1d3b
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 8 deletions.
5 changes: 5 additions & 0 deletions .changes/cjs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"meilisearch-docsearch": "minor"
---

Add support for `commonjs` target
6 changes: 3 additions & 3 deletions src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { render } from "solid-js/web";
import { DocSearch, type DocSearchProps } from "./DocSearch";

interface DocSearchOptions extends DocSearchProps {
export interface DocSearchOptions extends DocSearchProps {
container: HTMLElement | string;
}

export default function docsearch(props: DocSearchOptions) {
export function docsearch(props: DocSearchOptions) {
render(
() => <DocSearch {...props} />,
typeof props.container === "string"
Expand All @@ -16,4 +16,4 @@ export default function docsearch(props: DocSearchOptions) {
);
}

export { docsearch, type DocSearchOptions };
export default docsearch;
4 changes: 0 additions & 4 deletions src/styles/index.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
@import "./variables.css";
@import "./button.css";
@import "./modal.css";

.docsearch--active {
overflow: hidden !important;
}
4 changes: 4 additions & 0 deletions src/styles/modal.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
.docsearch--active {
overflow: hidden !important;
}

.docsearch-modal-container,
.docsearch-modal-container * {
box-sizing: border-box;
Expand Down
2 changes: 1 addition & 1 deletion tsup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export default defineConfig(
[
{
entry: ["src/index.tsx"],
format: "esm",
format: ["esm", "cjs"],
dts: true,
clean: !config.watch,
minify: !config.watch,
Expand Down

0 comments on commit add1d3b

Please sign in to comment.