I'm trying since way too long to import this library in a React project using React's last version. At the moment, it's just a sandbox to try various things.
But I miserably fail everytime. I have tried to:
Import it in the public/index.html like any other "old school" scripts: "TS2304: Cannot find name 'EventSourcePolyfill'."
Import it in the public/index.html like any other "old school" scripts AND declare it as for angular by using declare var EventSourcePolyfill: any; : Uncaught SyntaxError: Unexpected token '<' (the < symbol is actually the beginning of the <!Doctype> tag of the public/index.html page
Import it like a module: import * as ES from "../node_modules/event-source-polyfill/src/eventsource.min.js"; -> nope: _Could not find a declaration file for module '../nodemodules/event-source-polyfill/src/eventsource.min.js'
Import it like a module: import EventSourcePolyfill from "../node_modules/event-source-polyfill/src/eventsource.min.js"; -> nope, same error
Import it like a module: import EventSourcePolyfill from "../node_modules/event-source-polyfill/src/eventsource.min.js"; -> nope, Could not find a declaration file for module 'event-source-polyfill'.
etc, etc...
I'm new to react, so i'm probably doing something wrong, but I hardly understand why we couldn't import it like any other module with a simple import EventSourcePolyfill from "event-source-polyfill";
Hi guys,
I'm trying since way too long to import this library in a React project using React's last version. At the moment, it's just a sandbox to try various things.
But I miserably fail everytime. I have tried to:
public/index.html
like any other "old school" scripts: "TS2304: Cannot find name 'EventSourcePolyfill'."public/index.html
like any other "old school" scripts AND declare it as for angular by usingdeclare var EventSourcePolyfill: any;
: Uncaught SyntaxError: Unexpected token '<' (the < symbol is actually the beginning of the <!Doctype> tag of thepublic/index.html
pageimport * as ES from "../node_modules/event-source-polyfill/src/eventsource.min.js";
-> nope: _Could not find a declaration file for module '../nodemodules/event-source-polyfill/src/eventsource.min.js'import EventSourcePolyfill from "../node_modules/event-source-polyfill/src/eventsource.min.js";
-> nope, same errorimport EventSourcePolyfill from "../node_modules/event-source-polyfill/src/eventsource.min.js";
-> nope, Could not find a declaration file for module 'event-source-polyfill'.etc, etc...
I'm new to react, so i'm probably doing something wrong, but I hardly understand why we couldn't import it like any other module with a simple
import EventSourcePolyfill from "event-source-polyfill";
Any idea / savior?