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
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.
192fc07 to
73effea
Compare
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 compiler and module-resolution changes can shift build output and
.d.tsgeneration across many published packages, though the PR targets config-only fixes with no runtime code edits.Overview
Upgrades the monorepo from TypeScript 5.1.6 to 6.0.3 across root and workspace packages, with no intended changes to SDK runtime source.
Compiler settings are adjusted for TS 6 defaults: most browser/bundler packages move from
moduleResolution: "node"tobundler, while Node-oriented packages (e.g.server-node, shared server libs, DynamoDB/Redis stores, OTel) usemodule/moduleResolution: "node16"instead of legacycommonjs+node. Many configs addignoreDeprecations": "6.0", refreshlibtoes2020(and sometimesdom), and explicitly settypesfor Jest/Node where needed.Jest / build wiring: root
jest.config.jspassests-jestatsconfigoverride forcingmodule: CommonJSfor tests.@launchdarkly/react-sdkaddstsconfig.build.json(deprecation suppression) and points tsup at it for DTS generation. Shopify Oxygen contract-tests disable tsupdtsto avoid TS 6 declaration emit issues.Minor example tweaks include hello-react
@types/react/@types/react-domat v19 and expanded server-ai exampletsconfigrootDir/outDir.Reviewed by Cursor Bugbot for commit 73effea. Bugbot is set up for automated code reviews on this repo. Configure here.