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(shaker): named exports are removed (#800) #801

Merged
merged 1 commit into from Jul 18, 2021
Merged

fix(shaker): named exports are removed (#800) #801

merged 1 commit into from Jul 18, 2021

Conversation

Anber
Copy link
Collaborator

@Anber Anber commented Jul 18, 2021

Motivation

See #800

Summary

In some cases, Babel generates code that depends on hoisted variables. Since shaker uses simplified tree traversing, it doesn't properly process those cases and isn't able to evaluate the dependencies of a shaking file.

The best solution here would be migration to @babel/traverse. However, it will take a while.
So that, this PR implements the worst solution :) I've added a dirty hack to preeval, that checks that generated code has those "wrong" variables and hoists them.

Test plan

One test was added, one test was fixed.

@Anber Anber merged commit 3421930 into master Jul 18, 2021
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

1 participant