plugins icon indicating copy to clipboard operation
plugins copied to clipboard

`@rollup/plugin-typescript` seems not recognizing `.d.[ext].ts` style definition files?

Open WRtux opened this issue 8 months ago • 2 comments

  • Rollup Plugin Name: @rollup/plugin-typescript
  • Rollup Plugin Version: 12.1.2
  • Rollup Version: 4.28.1
  • Operating System (or Browser): Windows 10
  • Node Version: v20.18.3
  • Link to reproduction: https://stackblitz.com/edit/rollup-repro-w7wg6yag?file=src%2Fmain.ts

Expected Behavior

Bundle successfully built with npm run build.

Actual Behavior

src/main.ts → dist...
[!] RollupError: src/chromaprint_bg.d.wasm.ts (2:9): Expected ',', got '?' (Note that you need plugins to import files that are not JavaScript)
src/chromaprint_bg.d.wasm.ts (2:9)
1: export default function (
2:   imports?: WebAssembly.Imports
            ^
3: ): Promise<WebAssembly.Instance>;
    at Object.getRollupError (/home/projects/rollup-repro-w7wg6yag/node_modules/rollup/dist/shared/parseAst.js:285:41)
    at ParseError.initialise (/home/projects/rollup-repro-w7wg6yag/node_modules/rollup/dist/shared/rollup.js:15820:40)
    at convertNode (/home/projects/rollup-repro-w7wg6yag/node_modules/rollup/dist/shared/rollup.js:17714:10)
    at convertProgram (/home/projects/rollup-repro-w7wg6yag/node_modules/rollup/dist/shared/rollup.js:16957:12)
    at Module.setSource (/home/projects/rollup-repro-w7wg6yag/node_modules/rollup/dist/shared/rollup.js:18695:24)
    at async ModuleLoader.addModuleSource (/home/projects/rollup-repro-w7wg6yag/node_modules/rollup/dist/shared/rollup.js:22265:13)
…

Additional Information

I was trying to integrate WASM in a TS project, utilizing TypeScript 5.0 allowArbitraryExtensions compiler option (where I provide defs with a .d.wasm.ts file) and got errors on it. It seems that the def file was not transformed or dropped by TypeScript plugin and went to later stages. I guess maybe it's @rollup/plugin-typescript not recognizing the def file? (though I did not actually dig into the code to verify the idea 🤦)

WRtux avatar Mar 31 '25 18:03 WRtux

Is this repository still active... 🤔

WRtux avatar May 13 '25 06:05 WRtux

Please don't post useless comments - it only adds noise.

Yes, this repository is still active. It's run and maintained by volunteers. You might benefit from reading https://liberamanifesto.com/

If you'd like to see your issue moved forward, you'll have to wait for a community member to pick it up, or you might consider opening a pull request.

shellscape avatar May 13 '25 14:05 shellscape