Sometimes you have to do horrible things, like use the global object to share a singleton. Abstract that away, with this!
by ljharbJavaScript
Last 12 weeks · 0 commits
4 of 6 standards met
Hi there! Here's the situation: Vite is becoming a more popular bundler. Unlike some other bundlers (e.g, Webpack), Vite does not provide a built-in variable. As such, if my project or any dependency uses global-cache, global-cache fails at runtime. !image In our case, we use react-dates, which has an indirect dependency on global-cache: !image global-cache fails because it assumes that exists, which it may not because, as far as I'm aware, was never part of any bundler/module spec outside of node. It was just a thing that some bundlers provided. This issue is discussed more in depth in the Vite repo. While there are workarounds, ideally global-cache would not depend on , rather than requiring users of Vite (or other bundlers that do not provide ) to implement those workarounds.
Repository: ljharb/global-cache. Description: Sometimes you have to do horrible things, like use the global object to share a singleton. Abstract that away, with this! Stars: 20, Forks: 4. Primary language: JavaScript. Languages: JavaScript (100%). License: MIT. Open PRs: 0, open issues: 1. Last activity: 6mo ago. Community health: 85%. Top contributors: ljharb, renovate-bot.