Skip to content

Commit

Permalink
feat: switch to ESM
Browse files Browse the repository at this point in the history
BREAKING CHANGE: output ESM instead of CommonJS
  • Loading branch information
wolfy1339 committed Feb 17, 2024
1 parent e2bcb2c commit 87dc90f
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 10 deletions.
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Expand Up @@ -3,6 +3,7 @@
"publishConfig": {
"access": "public"
},
"type": "module",
"version": "0.0.0-development",
"description": "Methods to handle GitHub Webhook requests",
"scripts": {
Expand All @@ -27,7 +28,7 @@
"author": "Gregor Martynus (https://dev.to/gr2m)",
"license": "MIT",
"devDependencies": {
"@octokit/tsconfig": "^2.0.0",
"@octokit/tsconfig": "^3.0.0",
"@types/jest": "^29.0.0",
"@types/node": "^20.0.0",
"esbuild": "^0.20.0",
Expand Down
16 changes: 11 additions & 5 deletions scripts/build.mjs
Expand Up @@ -32,7 +32,7 @@ async function main() {
bundle: true,
platform: "node",
target: "node18",
format: "cjs",
format: "esm",
...sharedOptions,
}),
// Build an ESM browser bundle
Expand Down Expand Up @@ -62,10 +62,16 @@ async function main() {
{
...pkg,
files: ["dist-*/**"],
main: "dist-node/index.js",
browser: "dist-web/index.js",
types: "dist-types/index.d.ts",
module: "dist-src/index.js",
exports: {
node: {
import: "./dist-node/index.js",
types: "./dist-types/index.d.ts",
},
browser: {
import: "./dist-web/index.js",
types: "./dist-types/web.d.ts",
},
},
sideEffects: false,
},
null,
Expand Down

0 comments on commit 87dc90f

Please sign in to comment.