Skip to content

Commit

Permalink
fix(sdk): Publish both esm and cjs modules for the sdk
Browse files Browse the repository at this point in the history
  • Loading branch information
MohamedBassem committed Jan 5, 2025
1 parent 93f8bdb commit 838d308
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
5 changes: 4 additions & 1 deletion apps/cli/src/commands/bookmarks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,10 @@ bookmarkCmd
collect<string>,
[],
)
.option("--title <title>", "if set, this will be used as the bookmark's title")
.option(
"--title <title>",
"if set, this will be used as the bookmark's title",
)
.action(async (opts) => {
const api = getAPIClient();

Expand Down
4 changes: 3 additions & 1 deletion packages/sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
],
"main": "./src/index.ts",
"publishConfig": {
"exports": "./dist/index.mjs",
"main": "./dist/index.js",
"exports": "./dist/index.js",
"module": "./dist/index.mjs",
"types": "./dist/index.d.ts"
},
"devDependencies": {
Expand Down
11 changes: 7 additions & 4 deletions packages/sdk/vite.config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,16 @@ import tsconfigPaths from "vite-tsconfig-paths";

export default defineConfig({
build: {
lib: {
entry: "src/index.ts",
formats: ["es", "cjs"],
fileName: (format) => `index.${format === "es" ? "mjs" : "js"}`,
},
rollupOptions: {
input: "src/index.ts",
output: {
dir: "dist",
},
external: ["openapi-fetch"],
},
ssr: true,
sourcemap: true,
},
plugins: [tsconfigPaths(), dts({ rollupTypes: true, copyDtsFiles: true })],
});

0 comments on commit 838d308

Please sign in to comment.