@foxglove/tsconfig 3.0.0 → 3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +18 -8
- package/base.json +3 -1
- package/bundler.json +1 -3
- package/node.json +1 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -18,7 +18,13 @@ yarn add -D @foxglove/tsconfig
|
|
|
18
18
|
|
|
19
19
|
Choose the config that matches your environment:
|
|
20
20
|
|
|
21
|
-
### Node.js applications and libraries
|
|
21
|
+
### Node.js applications and published libraries
|
|
22
|
+
|
|
23
|
+
Uses `module: "NodeNext"`, which enforces Node.js ESM rules.
|
|
24
|
+
|
|
25
|
+
Use `node.json` for published libraries, even if your library will be used in bundled apps. Bundlers consume Node-style packages natively, just remember to avoid Node-specific APIs like `fs` or `process`.
|
|
26
|
+
|
|
27
|
+
Relative imports must include explicit file extensions (e.g., `import { foo } from "./bar.ts"`).
|
|
22
28
|
|
|
23
29
|
```json
|
|
24
30
|
{
|
|
@@ -31,30 +37,34 @@ Choose the config that matches your environment:
|
|
|
31
37
|
}
|
|
32
38
|
```
|
|
33
39
|
|
|
34
|
-
>
|
|
40
|
+
> [!TIP]
|
|
41
|
+
> `base.json` uses `target: "ESNext"`. For published libraries, you may wish to set a lower target (e.g., `"ES2022"` for Node 18).
|
|
35
42
|
|
|
36
|
-
|
|
43
|
+
### Bundled applications (Webpack, Vite, esbuild, etc)
|
|
37
44
|
|
|
38
|
-
|
|
45
|
+
Uses `module: "Preserve"`, which enables optimizations for code consumed directly by a bundler.
|
|
39
46
|
|
|
40
|
-
|
|
47
|
+
Supports extensionless relative imports (e.g., `import { foo } from "./bar"`).
|
|
41
48
|
|
|
42
49
|
```json
|
|
43
50
|
{
|
|
44
51
|
"extends": "@foxglove/tsconfig/bundler.json",
|
|
45
|
-
"include": ["./src/**/*"]
|
|
52
|
+
"include": ["./src/**/*"],
|
|
53
|
+
"compilerOptions": {
|
|
54
|
+
"noEmit": true,
|
|
55
|
+
"lib": ["ESNext", "DOM"]
|
|
56
|
+
}
|
|
46
57
|
}
|
|
47
58
|
```
|
|
48
59
|
|
|
49
60
|
### Base config
|
|
50
61
|
|
|
51
|
-
Provides strict type-checking and modern defaults, but no `module
|
|
62
|
+
Provides strict type-checking and modern defaults, but no `module` or `moduleResolution` settings. Use this when `node.json` and `bundler.json` don't fit your environment:
|
|
52
63
|
|
|
53
64
|
```json
|
|
54
65
|
{
|
|
55
66
|
"extends": "@foxglove/tsconfig/base.json",
|
|
56
67
|
"compilerOptions": {
|
|
57
|
-
"target": "...",
|
|
58
68
|
"module": "...",
|
|
59
69
|
"moduleResolution": "..."
|
|
60
70
|
}
|
package/base.json
CHANGED
|
@@ -5,6 +5,9 @@
|
|
|
5
5
|
{
|
|
6
6
|
"$schema": "https://json.schemastore.org/tsconfig",
|
|
7
7
|
"compilerOptions": {
|
|
8
|
+
// Language
|
|
9
|
+
"target": "ESNext",
|
|
10
|
+
|
|
8
11
|
// Type checking
|
|
9
12
|
"strict": true,
|
|
10
13
|
"noFallthroughCasesInSwitch": true,
|
|
@@ -28,7 +31,6 @@
|
|
|
28
31
|
// Emit
|
|
29
32
|
"declaration": true,
|
|
30
33
|
"declarationMap": true,
|
|
31
|
-
"isolatedDeclarations": true,
|
|
32
34
|
"newLine": "lf",
|
|
33
35
|
"sourceMap": true,
|
|
34
36
|
|
package/bundler.json
CHANGED
package/node.json
CHANGED