Skip to content

Commit 5c2c55a

Browse files
authored
chore(unenv-preset): Add .cjs output for the preset (#7721)
1 parent 998d230 commit 5c2c55a

File tree

3 files changed

+20
-8
lines changed

3 files changed

+20
-8
lines changed

.changeset/shy-flies-float.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@cloudflare/unenv-preset": patch
3+
---
4+
5+
chore(unenv-preset): Add .cjs output for the preset
Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
import { defineBuildConfig } from "unbuild";
22

33
export default defineBuildConfig({
4+
declaration: true,
5+
rollup: {
6+
emitCJS: true,
7+
cjsBridge: true,
8+
},
49
entries: [
5-
{ input: "src/", outDir: "dist/src", format: "esm", declaration: true },
10+
"src/index",
11+
{ input: "src/runtime/", outDir: "dist/runtime", format: "esm" },
612
],
713
});

packages/unenv-preset/package.json

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,19 @@
2424
"type": "module",
2525
"exports": {
2626
".": {
27-
"types": "./dist/src/index.d.ts",
28-
"import": "./dist/src/index.mjs"
27+
"types": "./dist/index.d.ts",
28+
"require": "./dist/index.cjs",
29+
"import": "./dist/index.mjs"
2930
},
3031
"./runtime/*": {
31-
"types": "./dist/src/runtime/*.d.ts",
32-
"import": "./dist/src/runtime/*.mjs"
32+
"types": "./dist/runtime/*.d.ts",
33+
"import": "./dist/runtime/*.mjs"
3334
}
3435
},
35-
"main": "./dist/src/index.mjs",
36-
"types": "./dist/src/index.d.ts",
36+
"main": "./dist/index.cjs",
37+
"types": "./dist/index.d.ts",
3738
"files": [
38-
"dist/src"
39+
"dist"
3940
],
4041
"scripts": {
4142
"build": "unbuild",

0 commit comments

Comments
 (0)