plugins
plugins copied to clipboard
plugin-typescript errors when no tsconfig.json exists
- 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
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.
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",
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.
typescript({tsconfig: false})