Skip to content

Commit

Permalink
chore: export CJS module, #10
Browse files Browse the repository at this point in the history
  • Loading branch information
zensh committed Sep 23, 2024
1 parent ab34701 commit ea76748
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 13 deletions.
18 changes: 6 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "xid-ts",
"type": "module",
"version": "1.1.2",
"version": "1.1.3",
"author": "0xZensh <[email protected]>",
"description": "xid is a globally unique id generator thought for the web. A Typescript port of https://github.com/rs/xid.",
"license": "MIT",
Expand All @@ -13,27 +13,21 @@
"files": [
"dist",
"package.json",
"pnpm-lock.yaml",
"LICENSE",
"README.md"
],
"main": "dist/index.js",
"typings": "dist/index.d.ts",
"exports": {
".": {
"types": "./dist/index.d.ts",
"browser": "./dist/index.js",
"default": "./dist/index.js"
}
},
"main": "dist/cjs/index",
"module": "dist/esm/index",
"unpkg": "dist/esm/index",
"typings": "dist/esm/index.d.ts",
"browser": {
"node:crypto": false
},
"engines": {
"node": ">=18.0.0"
},
"scripts": {
"build": "npm run clean && tsc -p tsconfig.json",
"build": "npm run clean && tsc -p tsconfig.json && tsc -p tsconfig-cjs.json",
"clean": "rm -rf dist",
"lint": "eslint .",
"lint:fix": "eslint . --fix",
Expand Down
9 changes: 9 additions & 0 deletions tsconfig-cjs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"target": "es2018",
"module": "CommonJS",
"outDir": "./dist/cjs",
"moduleResolution": "node"
}
}
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"compilerOptions": {
"target": "es2022",
"module": "esnext",
"outDir": "./dist",
"outDir": "./dist/esm",
"importHelpers": true,
"moduleResolution": "bundler",
"resolveJsonModule": true,
Expand Down

0 comments on commit ea76748

Please sign in to comment.