#1146·ncc

Option 'allowImportingTsExtensions' can only be used when either 'noEmit' or 'emitDeclarationOnly' is set.

Author: lohrm-stablCreated Dec 4, 2023Updated Feb 1, 2026
Labelsbug

Hello,

I get the following error:

ncc: Version 0.38.1
ncc: Compiling file index.js into ESM
ncc: Using [email protected] (local user-provided)
Error: [tsl] ERROR
      TS5096: Option 'allowImportingTsExtensions' can only be used when either 'noEmit' or 'emitDeclarationOnly' is set.
    at /workspaces/SBC-Device-API/node_modules/@vercel/ncc/dist/ncc/index.js.cache.js:38:1896272
    at /workspaces/SBC-Device-API/node_modules/@vercel/ncc/dist/ncc/index.js.cache.js:38:396262
    at _done (eval at create (/workspaces/SBC-Device-API/node_modules/@vercel/ncc/dist/ncc/index.js.cache.js:21:75523), <anonymous>:9:1)
    at eval (eval at create (/workspaces/SBC-Device-API/node_modules/@vercel/ncc/dist/ncc/index.js.cache.js:21:75523), <anonymous>:34:22)
error: "ncc" exited with code 1 (SIGHUP)

While I have both "allowImportingTsExtensions": true, and noEmit: true in my tsconfig.

Full config:

// https://gist.github.com/slavafomin/cd7a54035eff5dc1c7c2eff096b23b6b
{
  "$schema": "https://json.schemastore.org/tsconfig",
  "compilerOptions": {
    // From: https://github.com/tsconfig/bases/blob/main/bases/node20.json
    "lib": [
      "es2023"
    ],
    "module": "node16",
    "target": "es2022",
    "strict": true,
    "esModuleInterop": true,
    "skipLibCheck": true,
    "forceConsistentCasingInFileNames": true,
    "moduleResolution": "node16",
    "allowSyntheticDefaultImports": true,
    // Most from: https://github.com/tsconfig/bases/blob/main/bases/strictest.json
    "allowUnusedLabels": false,
    "allowUnreachableCode": false,
    "exactOptionalPropertyTypes": true,
    "noFallthroughCasesInSwitch": true,
    "noImplicitOverride": true,
    "noImplicitReturns": true,
    "noPropertyAccessFromIndexSignature": true, // Conflicts with https://eslint.org/docs/latest/rules/dot-notation
    "noUncheckedIndexedAccess": true,
    "noUnusedLocals": true,
    "noUnusedParameters": true,
    "isolatedModules": true,
    "checkJs": true,
    // Custom
    "baseUrl": "./",
    "rootDir": "./src",
    "noEmit": true, // We use ncc to build our code
    "preserveConstEnums": true,
    "noImplicitAny": true,
    "strictNullChecks": true,
    "allowImportingTsExtensions": true,
    "typeRoots": [
      "./node_modules/@types",
    ],
    "types": [
      "node"
    ]
  },
  "include": [
    "./src/**/*.ts"
  ],
  "exclude": [
    "./src/public/",
    "build.cjs",
    "dist/*"
  ],
  "ts-node": {
    "esm": true,
    "experimentalSpecifierResolution": "node",
  }
}