jsconfig.json option

customConditions

  • Default not set
  • Since TypeScript 5.0

A package's exports map can point to different files under different conditions: import, require, node, and any names the package invents, such as development. Node.js uses the extra ones only when you run it with --conditions (-C); bundlers have a setting for them. customConditions tells the checker to use the same ones, so it reads the files your code will actually load.

It works with moduleResolution set to node16, nodenext or bundler, and arrived with TypeScript 5.0.

At a glance

Write Only when your runtime or bundler resolves packages with extra conditions: list the same ones, for example ["development"]
On the command line --customConditions
Type string[]
Default in TypeScript 5.9 not set
TypeScript's description Conditions to set in addition to the resolver-specific defaults when resolving imports.

The description is quoted from TypeScript's own option list (Apache-2.0); see the notices.

Examples

main.js Error confirmed 5.9.3 TypeScript 5.9.3, run 21 October 2026: main.js(2,15): error TS2305: Module '"tiny-log"' has no exported member 'trace'. 6.0.3 TypeScript 6.0.3, run 21 October 2026: the same as 5.9.3. main.js(2,15): error TS2305: Module '"tiny-log"' has no exported member 'trace'. 7.0.2 TypeScript 7.0.2, run 21 October 2026: the same as 5.9.3. main.js(2,15): error TS2305: Module '"tiny-log"' has no exported member 'trace'. checked 21 October 2026
import { log, trace } from "tiny-log";error TS2305: Module '"tiny-log"' has no exported member 'trace'.

log("start");
trace("here");
Without customConditions: the package's default entry, which has no trace.
jsconfig.json for this example
{
  "compilerOptions": {
    "checkJs": true,
    "noEmit": true,
    "strict": true,
    "target": "es2022",
    "module": "nodenext",
    "types": []
  },
  "include": [
    "*.js"
  ]
}
main.js TypeScript 5.9.3 TypeScript 5.9.3, run 21 October 2026: No errors. 6.0.3 TypeScript 6.0.3, run 21 October 2026: the same as 5.9.3. No errors. 7.0.2 TypeScript 7.0.2, run 21 October 2026: the same as 5.9.3. No errors. checked 21 October 2026
import { log, trace } from "tiny-log";

log("start");
trace("here");
customConditions ["development"]: the development entry, with trace.
jsconfig.json for this example
{
  "compilerOptions": {
    "checkJs": true,
    "noEmit": true,
    "strict": true,
    "target": "es2022",
    "module": "nodenext",
    "types": [],
    "customConditions": [
      "development"
    ]
  },
  "include": [
    "*.js"
  ]
}

Keep it in step with the runtime

The examples use a package whose development entry exports an extra trace function. Checked with the default conditions, trace does not exist (TS2305); with customConditions: ["development"] it does. If you run node -C development main.js, the second config describes your program; if you run plain node main.js, the first one does, and trace really would be missing.

Gotchas

  • Conditions are read in the package's order, not yours: the first matching key in the exports map wins.

Sources

Last reviewed 20 October 2026.