build: upgrade to typescript 6#1424
Conversation
|
@launchdarkly/js-sdk-common size report |
|
@launchdarkly/browser size report |
|
@launchdarkly/js-client-sdk size report |
5a372d8 to
afad83f
Compare
85454a3 to
6e50860
Compare
|
@launchdarkly/js-client-sdk-common size report |
|
@cursor review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 462a5a2. Configure here.
462a5a2 to
d5e8b12
Compare
b34e511 to
fae592f
Compare
c294eca to
192fc07
Compare
| "resolveJsonModule": true, | ||
| "stripInternal": true, | ||
| "moduleResolution": "node", | ||
| "moduleResolution": "bundler", |
There was a problem hiding this comment.
🔴 CommonJS build breaks for two packages because their module resolution setting is incompatible with CommonJS output
The module resolution is changed to "bundler" (packages/sdk/vercel/tsconfig.json:18 and packages/shared/sdk-server-edge/tsconfig.json:17), but both packages are built via scripts/build-package.sh, which invokes tsc --module commonjs. TypeScript does not allow moduleResolution: "bundler" when module is commonjs, so the CJS build will fail with a compiler error.
Impact: The vercel SDK and the server-edge shared package cannot be built, blocking all releases that depend on them.
Build script passes --module commonjs which conflicts with bundler resolution
The build script at scripts/build-package.sh:30 runs:
tsc --module commonjs --outDir dist/cjs/
This overrides the tsconfig module field to commonjs at compile time, but moduleResolution remains "bundler" from the tsconfig. TypeScript enforces that moduleResolution: "bundler" can only be used with module values of es2015 or later, node16, or nodenext — not commonjs. The previous value of moduleResolution: "node" was compatible with any module setting.
Affected tsconfigs:
packages/sdk/vercel/tsconfig.json:18packages/shared/sdk-server-edge/tsconfig.json:17
Prompt for agents
The packages/sdk/vercel and packages/shared/sdk-server-edge packages use scripts/build-package.sh for their build, which runs tsc --module commonjs for the CJS output. Changing moduleResolution to bundler in their tsconfig.json files is incompatible with this because TypeScript does not allow moduleResolution bundler with module commonjs.
Two possible fixes:
1. Revert moduleResolution to node in these two tsconfigs (packages/sdk/vercel/tsconfig.json and packages/shared/sdk-server-edge/tsconfig.json), or use node16 which is compatible with both commonjs and es2022.
2. Update scripts/build-package.sh to also pass --moduleResolution node16 (or node) when building the CJS output, so the CLI flag overrides the tsconfig for both module and moduleResolution.
Was this helpful? React with 👍 or 👎 to provide feedback.
There was a problem hiding this comment.
Specifically documented as supported in https://www.typescriptlang.org/docs/handbook/release-notes/typescript-6-0.html.
This PR will update all of the configuration files (
package.json,jest.config.js, andtsconfig.json) to use typescript 6.There shouldn't be any implementation changes here as all implementation at this point should conform nicely with the new typescript version.
Note
Medium Risk
Wide config-only change affects how every package type-checks and builds; wrong module resolution could alter emit or break CI, but no runtime logic is touched.
Overview
Upgrades the workspace from TypeScript 5.1.6 to 6.0.3 across root and package
devDependencies, with no SDK/runtime source edits in this diff.Compiler settings are aligned with TS 6 expectations:
moduleResolutionmoves fromnodetobundlerfor most browser/ESM packages and tonode16for Node-oriented packages (e.g.server-node, sharedsdk-server, DynamoDB/Redis stores). Several configs switchmodulefromcommonjstonode16orESNext, bumplibtowardes2020, and addignoreDeprecations": "6.0"where legacy options still apply. Explicittypesforjest/nodeappear in multipletsconfig.jsonfiles.Tooling tweaks: root
jest.config.jsconfigurests-jestwithmodule: CommonJS;@launchdarkly/react-sdkaddstsconfig.build.jsonand pointstsupat it for declaration emit. Shopify Oxygen contract-tests setdts: falseintsup. The hello-react example bumps@types/react/@types/react-domto v19. Manyjest.config.jsonfiles are reformatted without behavioral changes.Reviewed by Cursor Bugbot for commit 192fc07. Bugbot is set up for automated code reviews on this repo. Configure here.