Firestore: fix rollup config to keep intermediate bundles for source maps #7379
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Firestore's rollup configuration produces some "intermediate" bundles, which are then further processed into the ultimate bundles. However, these "intermediate" bundles happen to have the same name as some of the "ultimate" bundles and get clobbered. As a result, the source maps refer to the bundled file rather than to the original sources, rendering the source maps useless.
Although I wasn't able to figure out how to get the source maps of the "ultimate" bundles to point to the original sources, I figured out how to at least save the "intermediate" bundles. This allows a 2-step process to look up the original source code by first looking up the map from the "ultimate" file to the "intermediate" file, then from the "intermediate" file to the original source code.