-
Notifications
You must be signed in to change notification settings - Fork 191
Closed
Description
During SSR rendering, an error occurs: Cannot read properties of undefined (reading 'Event')
. The specific location of the error is in: plot.js:183:59
. https://github.com/observablehq/plot/blame/90a56897cabda400e2b7537f8ecbbd2cebd18f7f/src/plot.js#L183
The reason might be that in the SSR environment, a virtual implementation of the Document element is needed. However, the example provided (which I referenced from this Observable example) is somewhat outdated.
I added the following line of code in the constructor of Document, to work around this issue:
class Document {
constructor() {
this.documentElement = new Element(this, 'html');
this.defaultView = { Event }; // workaround
}
// other things
}
Perhaps the example file needs to be updated?
danielgamage, marr and zakyum
Metadata
Metadata
Assignees
Labels
No labels