Skip to content

Commit

Permalink
Distribute package as both ESM and CJS (#25)
Browse files Browse the repository at this point in the history
  • Loading branch information
zidhuss authored May 5, 2024
1 parent ba48112 commit 1cabfec
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
12 changes: 10 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
{
"name": "kysely-d1",
"description": "Kysely dialect for Cloudflare D1",
"main": "./dist/index.js",
"main": "./dist/index.cjs",
"module": "./dist/index.js",
"version": "0.3.0",
"types": "./dist/index.d.ts",
"repository": "[email protected]:aidenwallis/kysely-d1.git",
"author": "Aiden <[email protected]>",
"license": "MIT",
"type": "module",
"exports": {
".": {
"import": "./dist/index.js",
"require": "./dist/index.cjs"
}
},
"files": [
"dist"
],
Expand All @@ -18,7 +26,7 @@
"serverless"
],
"scripts": {
"build": "tsc",
"build": "tsc && tsc -p tsconfig.cjs.json && mv dist/cjs/index.js dist/index.cjs && rmdir dist/cjs",
"check": "prettier --check src/ example/",
"format": "prettier --write src/ example/"
},
Expand Down
8 changes: 8 additions & 0 deletions tsconfig.cjs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"module": "CommonJS",
"outDir": "dist/cjs",
"declaration": false
}
}
1 change: 1 addition & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"extends": "@tsconfig/node14/tsconfig.json",
"compilerOptions": {
"rootDir": "src",
"module": "ESNext",
"outDir": "dist",
"alwaysStrict": true,
"skipLibCheck": true,
Expand Down

0 comments on commit 1cabfec

Please sign in to comment.