`@rollup/plugin-typescript` seems not recognizing `.d.[ext].ts` style definition files?
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- javascript, typescript, wasm
- Domain
- build-system, tooling
Research direction
Start with the StackBlitz reproduction and run npm run build to confirm the failure involving src/main.ts and src/chromaprint_bg.d.wasm.ts. Then inspect how @rollup/plugin-typescript handles the .d.wasm.ts declaration file; done means the reproduction builds successfully without the declaration file reaching Rollup's JavaScript parser.
Written by the indexing model from the issue text.
Description
- 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 🤦)
- Dominant language
- JavaScript
- Stars
- 3.8k
- Forks
- 635
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from rollup/plugins
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 4/5 3-5 days Newbie friendliness 52/100
-
Difficulty 3/5 1-2 days Newbie friendliness 48/100
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
-
Support js-yaml v5 Open
Difficulty 4/5 3-5 days Newbie friendliness 45/100
Similar issues
-
bot:ai-assisted component:compact-js status:untriaged
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
midnightntwrk/midnight-sdk#403 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 92/100
-
Difficulty 1/5 1-3 hours Newbie friendliness 86/100
DavidAnson/markdownlint-cli2#940 ·
-
documentation
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
githubnext/gh-aw-workshop#3692 ·
-
agent/guide documentation hive/hosted-available-lke648397-260827-5n31
Difficulty 2/5 1-3 hours Newbie friendliness 90/100