fix: rename caches to commonCaches - #628
Conversation
Renames the `caches` variable because it interferes with the global browser API. Fixesbenjamn#492
| }; | ||
| const caches = new Set<CommonCache<any, AnyEntry>>(); | ||
| const commonCaches = new Set<CommonCache<any, AnyEntry>>(); |
There was a problem hiding this comment.
__caches might be another alternative since it just seems like a local variable and it seems to be unintended to be accessed in the global scope.
benjamn
commented
Dec 14, 2023
Can you say more about why this causes problems? In my understanding, If the |
steabert
commented
Dec 16, 2023
I wrote the #492 issue, but realize now I probably made a mistake when migrating from an IIFE bundle loaded as Thanks for pointing in the right direction! |
impaler
commented
Jul 26, 2024
I ran into a similar issue trying to bundle apollo client with esbuild I guess this PR is kind of a subjective request, library authors have no technical reason why they can't own their own namespace. It just seems like a common convention to avoid browser window apis for perhaps "readability". eg a routing library that supports the browser, would probably never have a |
Renames the
cachesvariable because it interferes with the global browser API.https://developer.mozilla.org/en-US/docs/Web/API/caches
Fixes#492