-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
SyntaxError: Indirectly exported binding name 'AnyArena' is not found. #5426
Comments
Same ussue |
Similar error here 🙋♂️ Bellow re-export does not work export {SerializedTypes} from '@mionkit/runtype'; neither re-export as type only export type {SerializedTypes} from '@mionkit/runtype'; Workaround: import {SerializedTypes} from '@mionkit/runtype';
export type {SerializedTypes}; similar to #74 |
I did a bit more digging into this today. It seems like the issue stems from There's no mention of The initial Strangely, this resolves to I had a thought that perhaps |
https://github.com/oven-sh/bun/blob/main/src/resolver/resolver.zig#L3607 👀 I guess this is intended behaviour? |
I think I understand now (and should have just listened to the referenced issue). The transpiler currently doesn't know the type-ness of re-exported values, hence you need |
But this is workaround. This needs fixing. |
Am I correct in thinking that if this bug is being caused by importing a 3rd party module that there's no workaround at the moment? |
Thanks @M-jerez , your workaround works! |
Had the same issue, if anything TS itself is dropping the ambiguity between type and non-type modules, cant blame bun for not handling the craziness. Just use EsLint rule or the TSC compiler option and be happy. If you're curious why this happens I'm pretty sure its getting confused in compiling back to JS and stripping the types, trying to import something that doesn’t exist anymore because it has been stripped but the import has lost the context that is is a type import and it doesn’t exist anymore something something, the TSC rule has more context on why. |
This is happening because Bun is transpiling the Specifically: + export { type AnyArena } from "./any-arena";
- export { AnyArena } from "./any-arena"; The fix is any of:
|
This isn't Bun's fault. Ordinarily projects need to opt-into Even better is to use |
So to answer your direct question, for npm compatibility, I think Bun will need to prefer loading the JS files from And the reason is that even though packages may ship TS source, there is currently no guarantee that such source is compilable by anything other than tsc. |
What version of Bun is running?
1.0.1+31aec4ebe325982fc0ef27498984b0ad9969162b
What platform is your computer?
Darwin 22.3.0 arm64 arm
What steps can reproduce the bug?
What is the expected behavior?
No error
What do you see instead?
Additional information
Seems related to #1852, although I was unable to create a minimal repro.
Digging into the library,
AnyArena
is exported as a type that is a union of two classes exported from other modules.See https://github.com/jdiaz5513/capnp-ts/blob/108850ece76b33755d552f78eac736055ec8f1b4/packages/capnp-ts/src/serialization/arena/any-arena.ts
The text was updated successfully, but these errors were encountered: