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

オープン
#1,858 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
javascript, typescript, wasm

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

x⁷ ⋅ stale
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 🤦)

主要言語
JavaScript
スター
3.8k
フォーク
635
PR マージ指標
30日以内にマージされた PR はありません

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

rollup/plugins のほかの issue

rollup/plugins の issue をすべて見る

似ている issue

JavaScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。