Skip to content

Commit c01d542

Browse files
authored
Merge pull request #9 from github/add-cjs-exports
Add cjs exports
2 parents a34dcef + f5a621b commit c01d542

File tree

3 files changed

+28
-8
lines changed

3 files changed

+28
-8
lines changed

decorator/package.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"name": "@github/memoize/decorator",
3+
"types": "../dist/esm/decorator.d.ts",
4+
"main": "../dist/cjs/decorator.js",
5+
"module": "../dist/esm/decorator.js",
6+
"sideEffects": false
7+
}

package.json

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,32 @@
99
"license": "MIT",
1010
"author": "GitHub Inc. (https://github.com)",
1111
"type": "module",
12+
"main": "dist/cjs/index.js",
13+
"module": "dist/esm/index.js",
1214
"exports": {
13-
".": "./dist/index.js",
14-
"./decorator": "./dist/decorator.js"
15+
".": {
16+
"module": "./dist/esm/index.js",
17+
"import": "./dist/esm/index.js",
18+
"require": "./dist/cjs/index.js",
19+
"types": "./dist/esm/index.d.ts"
20+
},
21+
"./decorator": {
22+
"module": "./dist/esm/decorator.js",
23+
"import": "./dist/esm/decorator.js",
24+
"require": "./dist/cjs/decorator.js",
25+
"types": "./dist/esm/decorator.d.ts"
26+
}
1527
},
16-
"main": "dist/index.js",
17-
"module": "dist/index.js",
18-
"types": "dist/index.d.ts",
28+
"types": "./dist/esm/index.d.ts",
1929
"files": [
20-
"dist"
30+
"dist",
31+
"decorator"
2132
],
2233
"scripts": {
2334
"prebuild": "npm run clean && npm run lint && mkdir dist",
24-
"build": "tsc",
35+
"build": "npm run build:esm && npm run build:cjs",
36+
"build:esm": "tsc",
37+
"build:cjs": "tsc --module commonjs --outDir dist/cjs",
2538
"clean": "rm -rf dist",
2639
"lint": "eslint --report-unused-disable-directives . --color --ext .js,.ts,.tsx && tsc --noEmit",
2740
"prepublishOnly": "npm run build",

tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"moduleResolution": "node",
1212
"declaration": true,
1313
"declarationMap": true,
14-
"outDir": "dist",
14+
"outDir": "dist/esm",
1515
"experimentalDecorators": true
1616
},
1717
"exclude": ["test", "dist"]

0 commit comments

Comments
 (0)