Swatinem / rollup-plugin-dts

A rollup plugin to generate .d.ts rollup files for your typescript project
GNU Lesser General Public License v3.0
815 stars 71 forks source link

Declaration source maps are broken #280

Closed mrazauskas closed 1 year ago

mrazauskas commented 1 year ago

Checklist

Code Snipped

export function sum(a: string, b: string) {
  return a + b;
}

Repro

To make life easier, I have created reproduction repo: https://github.com/mrazauskas/x-rollup-declaration-map

Please clone it and follow these steps to reproduce the issue:

  1. Run yarn to install dependencies.
  2. Run yarn build --declarationMap. It will use tsc directly, the resulting declaration file and its source map can be found in the ./build directory.
  3. Run yarn bundle --sourcemap. It will use Rollup together with the rollup-plugin-dts, the resulting declaration file and its source map can be found in the ./bundle directory. sourceMappingURL is included in the index.d.ts file, but unfortunately the index.d.ts.map is broken.

I would expect to have working index.d.ts.map in the ./bundle directory. Why not? Rollup has great support for source maps.

Swatinem commented 1 year ago

Declaration SourceMaps are generally not supported. Feature development has also halted on this project, see #277

mrazauskas commented 1 year ago

Thanks. This is your project. Just wanted to draw attention.

llllvvuu commented 1 year ago

@mrazauskas could you share the repo again? I am considering to try making a fork with this feature

mrazauskas commented 1 year ago

I don't have it any more, but it was rather simple project with two ts. Building it with tsc was emitting the mapping for .d.ts. But building it with Rollup with --sourcemap flag was emitting empty/broken mapping.