Skip to content

Commit 93c8f1f

Browse files
authored
refactor tsconfig -- make consistent (#547)
* refactor tsconfig -- make consistent * always include src * add changeset
1 parent 59a948e commit 93c8f1f

File tree

12 files changed

+60
-42
lines changed

12 files changed

+60
-42
lines changed

.changeset/tidy-chairs-whisper.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@segment/analytics-core': patch
3+
---
4+
5+
Fix "failed to parse source map" in analytics-core ([#420](https://github.com/segmentio/analytics-next/issues/420))

packages/browser/package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"license": "MIT",
1010
"main": "./dist/cjs/index.js",
1111
"module": "./dist/pkg/index.js",
12-
"types": "./dist/pkg/index.d.ts",
12+
"types": "./dist/types/index.d.ts",
1313
"browser": {
1414
"./dist/cjs/node": "./dist/cjs/node/node.browser.js",
1515
"./dist/cjs/node.js": "./dist/cjs/node/node.browser.js",
@@ -18,7 +18,9 @@
1818
},
1919
"files": [
2020
"dist/",
21-
"src/"
21+
"src/",
22+
"!**/__tests__/**",
23+
"!**/tester/**"
2224
],
2325
"sideEffects": false,
2426
"scripts": {

packages/browser/tsconfig.build.json

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,15 @@
33
"include": ["src"],
44
"exclude": ["**/__tests__/**", "**/test-helpers/**", "**/tester/**"],
55
"compilerOptions": {
6-
"outDir": "./dist/pkg"
6+
"incremental": false,
7+
"outDir": "./dist/pkg",
8+
"importHelpers": true,
9+
// publish sourceMaps
10+
"sourceMap": true,
11+
// publish declarationMaps (enable go-to-definition in IDE)
12+
"declarationMap": true,
13+
// add type declarations to "types" folder
14+
"declaration": true,
15+
"declarationDir": "./dist/types"
716
}
817
}

packages/browser/tsconfig.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
{
22
"extends": "../../tsconfig.json",
33
"compilerOptions": {
4-
"importHelpers": true,
54
"module": "esnext",
65
"target": "ES5",
7-
"declaration": true,
86
"moduleResolution": "node",
7+
"importHelpers": true,
98
"resolveJsonModule": true,
109
"sourceMap": true,
1110
"lib": ["es2020", "DOM"],

packages/browser/webpack.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ const config = {
6363
{
6464
loader: 'ts-loader',
6565
options: {
66+
configFile: 'tsconfig.build.json',
6667
transpileOnly: true,
6768
},
6869
},

packages/core/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@
1111
"module": "./dist/esm/index.js",
1212
"types": "./dist/types/index.d.ts",
1313
"files": [
14-
"dist/"
14+
"dist/",
15+
"src/",
16+
"!**/__tests__/**"
1517
],
1618
"sideEffects": false,
1719
"scripts": {

packages/core/tsconfig.build.json

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
{
22
"extends": "./tsconfig.json",
33
"include": ["src"],
4-
"exclude": ["**/__tests__/**", "**/*.test.*"]
4+
"exclude": ["**/__tests__/**", "**/*.test.*"],
5+
"compilerOptions": {
6+
"incremental": false,
7+
"outDir": "./dist/esm",
8+
"importHelpers": true,
9+
// publish sourceMaps
10+
"sourceMap": true,
11+
// publish declarationMaps (enable go-to-definition in IDE)
12+
"declarationMap": true,
13+
// add type declarations to "types" folder
14+
"declaration": true,
15+
"declarationDir": "./dist/types"
16+
}
517
}

packages/core/tsconfig.json

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,10 @@
11
{
22
"extends": "../../tsconfig.json",
3+
"exclude": ["node_modules", "dist"],
34
"compilerOptions": {
4-
"importHelpers": true,
55
"module": "esnext",
6-
"lib": ["es2020"],
76
"target": "ES5",
8-
"outDir": "./dist/esm", // TODO: move to base tsconfig
97
"moduleResolution": "node",
10-
// publish sourceMaps
11-
"sourceMap": true, // TODO: move to base tsconfig
12-
// publish declarationMaps (enable go-to-definition in IDE)
13-
"declarationMap": true, // TODO: move to base tsconfig
14-
// add type declarations to "types" folder
15-
"declaration": true, // TODO: move to base tsconfig
16-
"declarationDir": "./dist/types" // TODO: move to base tsconfig (once browser is refactored)
17-
},
18-
"exclude": ["node_modules", "dist"]
8+
"lib": ["es2020"]
9+
}
1910
}

packages/node/package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010
"import": "./dist/esm/index.js"
1111
},
1212
"files": [
13-
"dist/"
13+
"dist/",
14+
"src/",
15+
"!**/__tests__/**"
1416
],
1517
"engines": {
1618
"node": ">=12"
@@ -20,7 +22,7 @@
2022
"lint": "yarn concurrently 'yarn:eslint .' 'yarn:tsc --noEmit'",
2123
"build": "rm -rf dist && yarn concurrently 'yarn:build:*'",
2224
"build:cjs": "yarn tsc -p tsconfig.build.json --outDir ./dist/cjs --module commonjs",
23-
"build:esm": "yarn tsc -p tsconfig.build.json --outDir ./dist/esm --module esnext",
25+
"build:esm": "yarn tsc -p tsconfig.build.json",
2426
"watch": "yarn concurrently 'yarn:build:cjs --watch' 'yarn:build:esm --watch'",
2527
"watch:test": "yarn test --watch",
2628
"tsc": "yarn run -T tsc",

packages/node/tsconfig.build.json

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,15 @@
33
"include": ["src"],
44
"exclude": ["**/__tests__/**"],
55
"compilerOptions": {
6-
"incremental": false /* do not include .tsbuildinfo in prod build */
6+
"incremental": false,
7+
"outDir": "./dist/esm",
8+
"importHelpers": true,
9+
// publish sourceMaps
10+
"sourceMap": true,
11+
// publish declarationMaps (enable go-to-definition in IDE)
12+
"declarationMap": true,
13+
// add type declarations to "types" folder
14+
"declaration": true,
15+
"declarationDir": "./dist/types"
716
}
817
}

0 commit comments

Comments
 (0)