plotly / plotly/react-plotly.js

Snowpack => TypeError: can't access property "document", this is undefined

Offen
#228 3 Kommentare 4 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Vorherrschende Sprache
JavaScript
Sterne
1.1k
Forks
138
Ø Merge
3 T. 2 Std.
Gemergte PRs (30 T.)
4

Beschreibung

Hi, I'm trying to run a Typescript Reactjs installation with React-plotly using Snowpack and I get this error on runtime.

Uncaught TypeError: can't access property "document", this is undefined
    plotly</</<[169]</< http://localhost:3006/_snowpack/pkg/react-plotlyjs.js:26076
    plotly</</<[169]< http://localhost:3006/_snowpack/pkg/react-plotlyjs.js:35619
    o http://localhost:3006/_snowpack/pkg/react-plotlyjs.js:333
    o http://localhost:3006/_snowpack/pkg/react-plotlyjs.js:333
    plotly</</<[750]< http://localhost:3006/_snowpack/pkg/react-plotlyjs.js:108685
    o http://localhost:3006/_snowpack/pkg/react-plotlyjs.js:333
    o http://localhost:3006/_snowpack/pkg/react-plotlyjs.js:333
    plotly</</<[1]< http://localhost:3006/_snowpack/pkg/react-plotlyjs.js:335
    o http://localhost:3006/_snowpack/pkg/react-plotlyjs.js:333
    o http://localhost:3006/_snowpack/pkg/react-plotlyjs.js:333
    plotly</</<[727]< http://localhost:3006/_snowpack/pkg/react-plotlyjs.js:105568
    o http://localhost:3006/_snowpack/pkg/react-plotlyjs.js:333
    o http://localhost:3006/_snowpack/pkg/react-plotlyjs.js:333
    plotly</</<[14]< http://localhost:3006/_snowpack/pkg/react-plotlyjs.js:450
    o http://localhost:3006/_snowpack/pkg/react-plotlyjs.js:333
    o http://localhost:3006/_snowpack/pkg/react-plotlyjs.js:333
    plotly</</<[26]< http://localhost:3006/_snowpack/pkg/react-plotlyjs.js:498
    o http://localhost:3006/_snowpack/pkg/react-plotlyjs.js:333
    r http://localhost:3006/_snowpack/pkg/react-plotlyjs.js:333
    plotly http://localhost:3006/_snowpack/pkg/react-plotlyjs.js:333
    plotly http://localhost:3006/_snowpack/pkg/react-plotlyjs.js:333
    plotly http://localhost:3006/_snowpack/pkg/react-plotlyjs.js:333
    createCommonjsModule http://localhost:3006/_snowpack/pkg/common/_commonjsHelpers-b3efd043.js:14
    <anonymous> http://localhost:3006/_snowpack/pkg/react-plotlyjs.js:326
react-plotlyjs.js:26076:21
    plotly</</<[169]</< http://localhost:3006/_snowpack/pkg/react-plotlyjs.js:26076
    plotly</</<[169]< http://localhost:3006/_snowpack/pkg/react-plotlyjs.js:35619
    o http://localhost:3006/_snowpack/pkg/react-plotlyjs.js:333
    o http://localhost:3006/_snowpack/pkg/react-plotlyjs.js:333
    plotly</</<[750]< http://localhost:3006/_snowpack/pkg/react-plotlyjs.js:108685
    o http://localhost:3006/_snowpack/pkg/react-plotlyjs.js:333
    o http://localhost:3006/_snowpack/pkg/react-plotlyjs.js:333
    plotly</</<[1]< http://localhost:3006/_snowpack/pkg/react-plotlyjs.js:335
    o http://localhost:3006/_snowpack/pkg/react-plotlyjs.js:333
    o http://localhost:3006/_snowpack/pkg/react-plotlyjs.js:333
    plotly</</<[727]< http://localhost:3006/_snowpack/pkg/react-plotlyjs.js:105568
    o http://localhost:3006/_snowpack/pkg/react-plotlyjs.js:333
    o http://localhost:3006/_snowpack/pkg/react-plotlyjs.js:333
    plotly</</<[14]< http://localhost:3006/_snowpack/pkg/react-plotlyjs.js:450
    o http://localhost:3006/_snowpack/pkg/react-plotlyjs.js:333
    o http://localhost:3006/_snowpack/pkg/react-plotlyjs.js:333
    plotly</</<[26]< http://localhost:3006/_snowpack/pkg/react-plotlyjs.js:498
    o http://localhost:3006/_snowpack/pkg/react-plotlyjs.js:333
    r http://localhost:3006/_snowpack/pkg/react-plotlyjs.js:333
    plotly http://localhost:3006/_snowpack/pkg/react-plotlyjs.js:333
    plotly http://localhost:3006/_snowpack/pkg/react-plotlyjs.js:333
    plotly http://localhost:3006/_snowpack/pkg/react-plotlyjs.js:333
    createCommonjsModule http://localhost:3006/_snowpack/pkg/common/_commonjsHelpers-b3efd043.js:14
    <anonymous> http://localhost:3006/_snowpack/pkg/react-plotlyjs.js:326
    InnerModuleEvaluation self-hosted:2381
    InnerModuleEvaluation self-hosted:2381
    InnerModuleEvaluation self-hosted:2381
    InnerModuleEvaluation self-hosted:2381
    InnerModuleEvaluation self-hosted:2381
    InnerModuleEvaluation self-hosted:2381
    InnerModuleEvaluation self-hosted:2381
    evaluation self-hosted:2332

this is the culpable 26076 line

var d3_document = this.document;

I've contacted Snowpack team and the maintainer suggest that "most likely something is happening in that package that breaks non-Webpack bundling".
There is any plan to make React-plotly compatible with Snowpack or/and do you know any workaround to make it work in the meantime?

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginnen Sie mit dem generierten Bundle _snowpack/pkg/react-plotlyjs.js in Zeile 26076 und dem gemeldeten Fehler var d3_document = this.document. Prüfen Sie die verlinkte Snowpack-Diskussion und die Packaging-Einstiegspunkte von React-plotly.js, um die Kompatibilitätsgrenze zu bestimmen; abgeschlossen ist die Aufgabe, wenn die gemeldete TypeScript-React-Installation unter Snowpack ohne diesen Laufzeitfehler ausgeführt wird.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
javascript, react
Bereich
data-visualization, frontend
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.