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

fix: re-exports compiled by tsc not working #1083

Merged
merged 1 commit into from Oct 17, 2022

Conversation

GabbeV
Copy link
Contributor

@GabbeV GabbeV commented Oct 16, 2022

Motivation

The getOwnPropertyDescriptor method of the exports proxy seems to be incorrect causing export * compiled to commonjs by the typescript compiler to not work.

Typescript will compile export * to the following:

var __exportStar = (this && this.__exportStar) || function(m, exports) {
    for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};

Because getOwnPropertyDescriptor always return an object the hasOwnProperty call will always return true causing no exports to get added.

Here is a cut down example of this causing issues when using linaria together with @fluentui/react https://stackblitz.com/edit/linaria-bug-nl1c3w

Summary

The only change made in this PR is to only return a property descriptor when the export exist.

Test plan

I added a test that tests verifies that export * compiled to commonjs by tsc works. The test fails without my change but works with it.

Anber added a commit that referenced this pull request Oct 17, 2022
@Anber Anber merged commit 3c1886a into callstack:master Oct 17, 2022
Anber added a commit that referenced this pull request Oct 17, 2022
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

Successfully merging this pull request may close these issues.

None yet

2 participants