Skip to content

Commit

Permalink
fixup!: adjust tsconfigs to support oldest node LTS version
Browse files Browse the repository at this point in the history
  • Loading branch information
JakobJingleheimer committed Feb 3, 2025
1 parent 9bb1dde commit 111564c
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions apps/site/pages/en/learn/typescript/publishing-a-ts-project.md
Original file line number Diff line number Diff line change
Expand Up @@ -225,11 +225,12 @@ jobs:
"allowArbitraryExtensions": true,
"declaration": true,
"declarationMap": true,
"lib": ["ESNext"],
"lib": ["es2023"],
"module": "NodeNext",
"outDir": "./",
"resolveJsonModule": true,
"rewriteRelativeImportExtensions": true
"rewriteRelativeImportExtensions": true,
"target": "es2022"
},
// These may be different for your repo:
"include": ["./src"],
Expand All @@ -243,11 +244,12 @@ jobs:
"allowArbitraryExtensions": true,
"declaration": true,
"declarationMap": true,
"lib": ["ESNext"],
"lib": ["es2023"],
"module": "NodeNext",
"outDir": "./dist",
"resolveJsonModule": true,
"rewriteRelativeImportExtensions": true
"rewriteRelativeImportExtensions": true,
"target": "es2022"
},
// These may be different for your repo:
"include": ["./src"],
Expand Down Expand Up @@ -315,6 +317,8 @@ src
test
```

You'll want to publish a package compiled to support all Node.js LTS versions since you don't know which version the consumer will be running; the `tsconfig`s in this article support node 18.x and later.

`npm publish` will automatically run [`prepack` beforehand](https://docs.npmjs.com/cli/using-npm/scripts#npm-publish). `npm` will also run `prepack` automatically before `npm pack --dry-run` (so you can easily see what your published package will be without actually publishing it). **Beware**, [`node --run` does _not_ do that](../command-line/run-nodejs-scripts-from-the-command-line.md#using-the---run-flag). You can't use `node --run` for this step, so that caveat does not apply here, but it can for other steps.

The steps to actually publish to npm will be included in a separate article (there are several pros and cons beyond the scope of this article).
Expand Down

0 comments on commit 111564c

Please sign in to comment.