apply isomorphic standards to userland libraries and plugins (globalThis
)
#1005
Labels
CLI
enhancement
Improve something existing (e.g. no docs, new APIs, etc)
Plugins
Greenwood Plugins
SSR
Milestone
Overview
As called out in WCC and MDN, code that needs to run in multiple environments should delegate any "global" references to the new
globalThis
.This means that instead of calling
window.addEventListener
you would want to useglobalThis.addEventListener
.Each environment can choose to polyfill or support some, none, or all of these features, and the code doesn't necessarily have to worry about feature detection, e.g.
Details
For Greenwood, this would apply to
staticRouter
Should also update to latest version of WCC to accommodate this.
One way to test is to pre-render the website with WCC instead of Puppeteer.
The text was updated successfully, but these errors were encountered: