[@rollup/plugin-typescript] `--configPlugin` command option with Typescript plugin doesn't support `reference` option in tsconfig.json.
- Rollup Plugin Name: @rollup/plugin-typescript
- Rollup Plugin Version: 7.15.0
- Rollup Version: v4.20.0
- Operating System (or Browser): Windows 10
- Node Version: v20.13.1
- Link to reproduction (⚠️ read below): https://stackblitz.com/edit/rollup-repro-hfhjsp
Expected Behavior
Output successfully.
Actual Behavior
Throw error: Note that you need plugins to import files that are not JavaScript.
Additional Information
The rollup config file is include with the tsconfig file in references array.
same here, any solution?
tsconfig.json
{
"files": ["./dist/atomsbuildinfo"], // this root tsconfig just exists to compose sub-projects
"references": [
{
"path": "./src"
},
{
"path": "./src/components/atoms"
},
{
"path": "./src/components/molecules"
},
{
"path": "./src/components/organisms"
}
]
}
src\components\atoms\tsconfig.json
{
"extends": "../../../tsconfig-base.json",
"compilerOptions": {
"outDir": "../../../dist",
"composite": true, // needed for references sub-projects
"rootDir": ".",
"tsBuildInfoFile": "../../../dist/atomsbuildinfo",
"rootDirs": [
"../../../src",
"../../../src/component/atoms",
"../../../src/component/molecules",
"../../../src/component/organisms"
]
},
"references": [
{
"path": "../../../src" // test project depends on src
}
]
}
tsconfig-base.json
{
// see https://www.typescriptlang.org/tsconfig to better understand tsconfigs
// "include": ["./src/**/*/*"],
"compilerOptions": {
"allowJs": true,
// output .d.ts declaration files for consumers
"declaration": true,
"declarationDir": "./dist",
// interop between ESM and CJS modules. Recommended by TS
"esModuleInterop": true,
// error out if import and file system have a casing mismatch. Recommended by TS
"forceConsistentCasingInFileNames": true,
"importHelpers": true,
// transpile JSX to React.createElement
"jsx": "react",
"lib": ["dom", "esnext"],
"module": "esnext",
// use Node's module resolution algorithm, instead of the legacy TS one
"moduleResolution": "node",
// `tsdx build` ignores this option, but it is commonly used when type-checking separately with `tsc`
"noEmit": false,
"noFallthroughCasesInSwitch": true,
// linter checks for common issues
"noImplicitReturns": true,
// noUnused* overlap with @typescript-eslint/no-unused-vars, can disable if duplicative
"noUnusedLocals": false,
"noUnusedParameters": false,
// match output dir to input dir. e.g. dist/index instead of dist/src/index
"rootDir": "./src",
"outDir": "./dist",
// "baseUrl": "./src",
// "paths": {
// "*": ["*"]
// },
// significant perf increase by skipping checking .d.ts files, particularly those in node_modules. Recommended by TS
"skipLibCheck": true,
// output .js.map sourcemap files for consumers
"sourceMap": true,
// stricter type-checking for stronger correctness. Recommended by TS
"strict": true,
"typeRoots": ["./src/types", "node_modules/@types"],
// "emitDeclarationOnly": true
"target": "es6",
"build": true
}
}
Also running into this. Replacing my base tsconfig.json with my tsconfig.rollup.json allows rollup to handle rollup.config.ts, but obviously the rest of my project breaks.
- Rollup Plugin Name: @rollup/plugin-typescript
- Rollup Plugin Version: 12.1.0
- Rollup Version: v4.22.5
- Operating System (or Browser): Linux
- Node Version: v22.9.0
tsconfig.json
{
"files": [],
"references": [
{ "path": "./tsconfig.integrations.json" },
{ "path": "./tsconfig.rollup.json" },
{ "path": "./tsconfig.service-worker.json" },
],
}
tsconfig.rollup.json
{
"include": ["./rollup.config.ts"],
"compilerOptions": {
"composite": true,
"noEmit": true,
"esModuleInterop": true,
"module": "ESNext",
"moduleResolution": "Bundler",
"lib": ["ESNext"],
}
}
Ah it appears to not only break for rollup.config.ts, but my other files as well. I converted rollup.config.ts to mjs and I saw the same Note that you need plugins to import files that are not JavaScript for other files in my project.
its work for me in rollup config change the tsconfig to './tsconfig-base.json
plugins: [
typescript({ tsconfig: './tsconfig-base.json' }),
]
and use this command to make the d.ts files
yarn tsc -b -v
Hey folks. This issue hasn't received any traction for 60 days, so we're going to close this for housekeeping. If this is still an ongoing issue, please do consider contributing a Pull Request to resolve it. Further discussion is always welcome even with the issue closed. If anything actionable is posted in the comments, we'll consider reopening it. ⓘ