Skip to content

Commit 59c748b

Browse files
committed
build(tsconfig): emit esm output
1 parent 38930e0 commit 59c748b

File tree

4 files changed

+26
-7
lines changed

4 files changed

+26
-7
lines changed

package.json

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22
"name": "tslog",
33
"version": "2.11.0",
44
"description": "📝 Expressive TypeScript Logger for Node.js: Pretty errors, stack traces, code frames, and JSON output to attachable transports.",
5-
"main": "dist/index",
6-
"typings": "dist/index",
5+
"main": "./dist/cjs/index.js",
6+
"module": "./dist/esm/index.js",
7+
"types": "./dist/types/index.d.ts",
78
"engines": {
89
"node": ">=10"
910
},
@@ -12,7 +13,7 @@
1213
"ts-node-onchange": "onchange -i \"**/*.ts\" -- npm run ts-node",
1314
"start-ts": "npm run ts-node",
1415
"start": "node dist/example/index.js",
15-
"build": "tsc",
16+
"build": "tsc -b tsconfig.json tsconfig.esm.json tsconfig.types.json",
1617
"prepublishOnly": "npm run build && npm run test",
1718
"eslint": "eslint . --ext .ts",
1819
"eslint-fix": "eslint . --ext .ts --fix",
@@ -80,7 +81,8 @@
8081
"source-map-support": "^0.5.19"
8182
},
8283
"files": [
83-
"dist"
84+
"dist",
85+
"src"
8486
],
8587
"keywords": [
8688
"logger",

tsconfig.esm.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"extends": "./tsconfig.json",
3+
"compilerOptions": {
4+
"module": "esnext",
5+
"outDir": "dist/esm"
6+
}
7+
}

tsconfig.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,10 @@
1515
"emitDecoratorMetadata": true,
1616
"experimentalDecorators": true,
1717
"sourceMap": true,
18-
"declaration": true,
19-
"declarationMap": true,
2018
"strict": true,
2119
"suppressImplicitAnyIndexErrors": true,
2220
"allowSyntheticDefaultImports": true,
23-
"outDir": "dist"
21+
"outDir": "dist/cjs"
2422
},
2523
"include": [
2624
"src/*.ts",

tsconfig.types.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"extends": "./tsconfig.json",
3+
"compilerOptions": {
4+
"module": "esnext",
5+
"target": "es2015",
6+
"removeComments": false,
7+
"declaration": true,
8+
"declarationMap": true,
9+
"declarationDir": "dist/types",
10+
"emitDeclarationOnly": true
11+
}
12+
}

0 commit comments

Comments
 (0)