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

Function declaration not created when using export { default as foo } from '/path/to/foo' #129

Closed
AndrewLeedham opened this issue Dec 9, 2020 · 1 comment

Comments

@AndrewLeedham
Copy link

  • Version: 1.3.8
  • Rollup Version: 2.34.2
  • Node Version: 12.16.1
  • Does it work with tsc: Yes

Reproduction

I created a minimal repro which shows the results from both rollup-plugin-ts and tsc.
https://repl.it/@AndrewLeedham56/rollup-plugin-ts-namespace-repro

Expected Behavior

The declaration file to have both a function and namespace type, like the tsc output here: https://repl.it/@AndrewLeedham56/rollup-plugin-ts-namespace-repro#dist/tsc/foo.d.ts

This seems to be caused by export { default as Foo } from './foo'; as compiling ./foo.ts directly works as expected (I also tried export * from './foo' but that worked fine): https://repl.it/@AndrewLeedham56/rollup-plugin-ts-namespace-repro#dist/rollup-foo/foo.d.ts

Actual Behavior

It only has the namespace: https://repl.it/@AndrewLeedham56/rollup-plugin-ts-namespace-repro#dist/rollup/index.d.ts

@wessberg
Copy link
Owner

wessberg commented Apr 13, 2021

Hey Andrew,

Sorry for the late reply! This was due to a problem where ModuleDeclarations/NamespaceDeclarations could sometimes not be traced correctly, so their bindings would be deconflicted by mistake, and then the function was tree-shaken away.

I've since fixed this problem and will release a new version on NPM shortly.
I hope you found a workaround in the meantime :-)

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

2 participants