Skip to content

Commit 87dc90f

Browse files
committed
feat: switch to ESM
BREAKING CHANGE: output ESM instead of CommonJS
1 parent e2bcb2c commit 87dc90f

File tree

3 files changed

+17
-10
lines changed

3 files changed

+17
-10
lines changed

package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"publishConfig": {
44
"access": "public"
55
},
6+
"type": "module",
67
"version": "0.0.0-development",
78
"description": "Methods to handle GitHub Webhook requests",
89
"scripts": {
@@ -27,7 +28,7 @@
2728
"author": "Gregor Martynus (https://dev.to/gr2m)",
2829
"license": "MIT",
2930
"devDependencies": {
30-
"@octokit/tsconfig": "^2.0.0",
31+
"@octokit/tsconfig": "^3.0.0",
3132
"@types/jest": "^29.0.0",
3233
"@types/node": "^20.0.0",
3334
"esbuild": "^0.20.0",

scripts/build.mjs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ async function main() {
3232
bundle: true,
3333
platform: "node",
3434
target: "node18",
35-
format: "cjs",
35+
format: "esm",
3636
...sharedOptions,
3737
}),
3838
// Build an ESM browser bundle
@@ -62,10 +62,16 @@ async function main() {
6262
{
6363
...pkg,
6464
files: ["dist-*/**"],
65-
main: "dist-node/index.js",
66-
browser: "dist-web/index.js",
67-
types: "dist-types/index.d.ts",
68-
module: "dist-src/index.js",
65+
exports: {
66+
node: {
67+
import: "./dist-node/index.js",
68+
types: "./dist-types/index.d.ts",
69+
},
70+
browser: {
71+
import: "./dist-web/index.js",
72+
types: "./dist-types/web.d.ts",
73+
},
74+
},
6975
sideEffects: false,
7076
},
7177
null,

0 commit comments

Comments
 (0)