Skip to content

Commit

Permalink
chore(unenv-preset): Add .cjs output for the preset
Browse files Browse the repository at this point in the history
  • Loading branch information
vicb committed Jan 10, 2025
1 parent 54a8475 commit 160e9d9
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 8 deletions.
5 changes: 5 additions & 0 deletions .changeset/shy-flies-float.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@cloudflare/unenv-preset": patch
---

chore(unenv-preset): Add .cjs output for the preset
8 changes: 7 additions & 1 deletion packages/unenv-preset/build.config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
import { defineBuildConfig } from "unbuild";

export default defineBuildConfig({
declaration: true,
rollup: {
emitCJS: true,
cjsBridge: true,
},
entries: [
{ input: "src/", outDir: "dist/src", format: "esm", declaration: true },
"src/index",
{ input: "src/runtime/", outDir: "dist/runtime", format: "esm" },
],
});
15 changes: 8 additions & 7 deletions packages/unenv-preset/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,19 @@
"type": "module",
"exports": {
".": {
"types": "./dist/src/index.d.ts",
"import": "./dist/src/index.mjs"
"types": "./dist/index.d.ts",
"require": "./dist/index.cjs",
"import": "./dist/index.mjs"
},
"./runtime/*": {
"types": "./dist/src/runtime/*.d.ts",
"import": "./dist/src/runtime/*.mjs"
"types": "./dist/runtime/*.d.ts",
"import": "./dist/runtime/*.mjs"
}
},
"main": "./dist/src/index.mjs",
"types": "./dist/src/index.d.ts",
"main": "./dist/index.cjs",
"types": "./dist/index.d.ts",
"files": [
"dist/src"
"dist"
],
"scripts": {
"build": "unbuild",
Expand Down

0 comments on commit 160e9d9

Please sign in to comment.