plugins icon indicating copy to clipboard operation
plugins copied to clipboard

plugin-typescript errors when no tsconfig.json exists

Open Essk opened this issue 1 year ago • 3 comments

  • Rollup Plugin Name: plugin-typescript
  • Rollup Plugin Version: 11.1.3
  • Rollup Version: 3.7.5
  • Operating System (or Browser): Mac, linux, Chrome
  • Node Version: 18.2.0
  • Link to reproduction (⚠️ read below): https://replit.com/@Essk1/rollup-plugin-repro-no-tsconfig & https://replit.com/@Essk1/rollup-plugin-repro-with-tsconfig

Expected Behavior

@rollup/plugin-typescript should not error if given config directly

Actual Behavior

Error (plugin typescript) Error: Could not load /home/runner/rollup-plugin-repro-no-tsconfig/input.ts: Debug Failure when no tsconfig.json is provided

Additional Information

This may be a continuation of #1136. Noting that the exact same config throws no error when an empty tsconfig.json is provided

Essk avatar Aug 31 '23 13:08 Essk

I ran into this same issue. Adding declaration: true, declarationDir: "dist/types" to my rollup config resulted in Debug Failure error. Adding an empty tsconfig.json resolved it.

manbearwiz avatar Feb 17 '24 00:02 manbearwiz

I can confirm the issue still exists. I'm calling rollup programatically in my CLI utility. I'm passing all settings via plugin's parameter, so no actuall tsconfig.json content should ever be used. Rollup fails to bundle the project unless tsconfig.json exists in the folder I call CLI from. The tsconfig.json may be empty - only it's existence seems to be required for it to work.

import rollupTypescript from '@rollup/plugin-typescript'
...
// this settings object should be enough for rollup typescript plugin to work, but `tsconfig.json` is required from unknown reason
const myCustomTsconfigContent = {
    compilerOptions: ...
}
...
rollupTypescript(myCustomTsconfigContent)
...

My Rollup version:

"@rollup/plugin-typescript": "^11.1.6",
"rollup": "^4.12.1",
"typescript": "^5.3.2",

ondratra avatar Mar 23 '24 21:03 ondratra

This issue still exists and also happens for me when the option tsconfig is set to false which should be allowed as per documentation on npm.

grafik

typescript({tsconfig: false})

jannikac avatar May 22 '24 12:05 jannikac