-
Notifications
You must be signed in to change notification settings - Fork 139
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
export from
should be passed through _interopRequireDefault
#757
Comments
Hi @forivall , thanks for reporting! I agree that this is a bug. To be clear, the impact is that the re-export won't work correctly if "bar" is a regular CJS module, e.g. if it has a line like (A separate but related issue is whether to use live bindings vs a plain export assignment for the two-line version. That came up in #715 (comment) , and I have some hesitation with switching the behavior due to possible backcompat issues, though it might be fine.) |
No worries on timing. The issue doesnt impact anything at the moment, I just noticed when making notes of all of the quirks of sucrase that I need to be aware of. As far as the transitive binding, I think the Ideally, there should be flags for this, although, that does introduce maintenance burden. |
The two source files should generate equivalent imports transformation:
Sandbox
Sandbox
The output is identical with babel, and typescript uses its
__importDefault
in a different order. Sucrase only applies the_interopRequireDefault
in the first example.IMO, the sucrase transformed code should be as follows:
(unless
enableLegacyTypeScriptModuleInterop
is enabled, obvi)The text was updated successfully, but these errors were encountered: