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

Preserve property read side effects during tree shaking #180

Merged
merged 1 commit into from
Dec 19, 2022

Conversation

ghatchue
Copy link
Contributor

Preserve property read side effects during tree shaking.

With default tsdx settings, tree shaking assumes that there will be no side effects for object reads. This currently breaks firestorter functionality when the sync mode is set to 'Auto', which is the recommended setting. Specifically, the following lines are removed from the compiled js:

You can inspect firestorter.cjs.development.js to see it clearly.

This implies that observing (via mobx) these getters (i.e. isLoaded) will not have the intended effect of tracking that observable reference, and fetching data from the Firestore collection.

@IjzerenHein
Copy link
Owner

Wow, great find!!!

I will push this out immediately and see how we can solve this integrally so other bundlers also don't run into this into the future.

Thanks so much @ghatchue ❤️ 🙏

@IjzerenHein IjzerenHein merged commit d9dd95a into IjzerenHein:main Dec 19, 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.

2 participants