Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type-only files are being removed & declarations are created with a hash #165

Open
overflowz opened this issue Jan 9, 2022 · 0 comments

Comments

@overflowz
Copy link

  • Version: 2.0.5
  • Rollup Version: 2.63.0
  • Operating System and version (if applicable):
  • Node Version (if applicable):
  • Does it work with tsc (if applicable): Yes.

Reproduction

Create two files, one for types, another one to use it, for example:

// types.ts
export interface Foo {
  foo: number;
}
// index.ts
import { Foo } from './types';
export const foo: Foo = {
  foo: 123,
};

Now run the build (rollup with rollup-plugin-ts enabled). The output will be the only index.js and types-[hash].d.ts.

Expected Behavior

Files with only declarations inside should be generated as empty js files (or at least have an option to do so) and d.ts files should be generated with the same file name + d.ts

Actual Behavior

Files with only declarations inside get removed and d.ts file is generated with a random hash (i.e., types-1fb4813.d.ts).

Notes

This is actually critical for me when bundling project with preserveModules set to true, because for example in my case, things generated like this:
some/path/to/declarations.ts does not generate any js file (which is fine, but at least I need .d.ts to be generated in that place with the original name + .d.ts) and in the root of build folder, it generates declarations-951a8ca8.d.ts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant