Skip to content

Commit c13f3a6

Browse files
create commonjs build for SSR projects
1 parent a62edd9 commit c13f3a6

3 files changed

Lines changed: 17 additions & 2 deletions

File tree

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,12 @@
1111
"license": "MIT",
1212
"private": false,
1313
"main": "dist/index.js",
14+
"module": "dist/esm/index.js",
1415
"typings": "dist/index.d.ts",
1516
"scripts": {
16-
"build": "tsc",
17+
"build": "npm run build:node && npm run build:esm",
18+
"build:node": "tsc",
19+
"build:esm": "tsc --project tsconfig.esnext.json",
1720
"lint": "eslint --ext js,ts,tsx src",
1821
"lint:fix": "npm run lint -- --fix",
1922
"test": "jest --config jestconfig.json --passWithNoTests",

tsconfig.esnext.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"compilerOptions": {
3+
"target": "es5",
4+
"module": "esnext",
5+
"moduleResolution": "node",
6+
"declaration": true,
7+
"outDir": "./dist/esm",
8+
"strict": true,
9+
"esModuleInterop": true
10+
},
11+
"include": ["src"],
12+
"exclude": ["node_modules", "**/__test__/*", "**/__tests__/*"]
13+
}

tsconfig.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{
22
"compilerOptions": {
33
"target": "es5",
4-
"module": "esnext",
54
"moduleResolution": "node",
65
"declaration": true,
76
"outDir": "./dist",

0 commit comments

Comments
 (0)