Skip to content

Commit ea76748

Browse files
committed
chore: export CJS module, #10
1 parent ab34701 commit ea76748

File tree

3 files changed

+16
-13
lines changed

3 files changed

+16
-13
lines changed

package.json

+6-12
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "xid-ts",
33
"type": "module",
4-
"version": "1.1.2",
4+
"version": "1.1.3",
55
"author": "0xZensh <[email protected]>",
66
"description": "xid is a globally unique id generator thought for the web. A Typescript port of https://github.com/rs/xid.",
77
"license": "MIT",
@@ -13,27 +13,21 @@
1313
"files": [
1414
"dist",
1515
"package.json",
16-
"pnpm-lock.yaml",
1716
"LICENSE",
1817
"README.md"
1918
],
20-
"main": "dist/index.js",
21-
"typings": "dist/index.d.ts",
22-
"exports": {
23-
".": {
24-
"types": "./dist/index.d.ts",
25-
"browser": "./dist/index.js",
26-
"default": "./dist/index.js"
27-
}
28-
},
19+
"main": "dist/cjs/index",
20+
"module": "dist/esm/index",
21+
"unpkg": "dist/esm/index",
22+
"typings": "dist/esm/index.d.ts",
2923
"browser": {
3024
"node:crypto": false
3125
},
3226
"engines": {
3327
"node": ">=18.0.0"
3428
},
3529
"scripts": {
36-
"build": "npm run clean && tsc -p tsconfig.json",
30+
"build": "npm run clean && tsc -p tsconfig.json && tsc -p tsconfig-cjs.json",
3731
"clean": "rm -rf dist",
3832
"lint": "eslint .",
3933
"lint:fix": "eslint . --fix",

tsconfig-cjs.json

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"extends": "./tsconfig.json",
3+
"compilerOptions": {
4+
"target": "es2018",
5+
"module": "CommonJS",
6+
"outDir": "./dist/cjs",
7+
"moduleResolution": "node"
8+
}
9+
}

tsconfig.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"compilerOptions": {
33
"target": "es2022",
44
"module": "esnext",
5-
"outDir": "./dist",
5+
"outDir": "./dist/esm",
66
"importHelpers": true,
77
"moduleResolution": "bundler",
88
"resolveJsonModule": true,

0 commit comments

Comments
 (0)