Alcumus / react-doc-viewer

Apache License 2.0
243 stars 103 forks source link

Uncaught ReferenceError: DataStream is not defined #91

Open gmore02 opened 3 years ago

gmore02 commented 3 years ago

Capture Getting this error const docs = [ { uri: 'https://url-to-my-pdf.pdf' }, ];

mlfcnt commented 3 years ago

Same error here :/

andygr1n1 commented 3 years ago

Our team replaced the project from create-react-app to vite, and this problem has appeared. Now I try to resolve it, let's be in touch

arung-agamani commented 2 years ago

Our team replaced the project from create-react-app to vite, and this problem has appeared. Now I try to resolve it, let's be in touch

Sorry for necrobumping, but I managed to solve the problem in Vite by declaring global window variable in the index.html file, just to make a reference to the said object for DataStream.js to use.

Added this in the <head>


<script>
window.DataStream = null;
</script>```
vmontoyarugertek commented 2 years ago

I have thre same error but the solution @arung-agamani it doesn't work for me. someone has an idea to solve

vmontoyarugertek commented 2 years ago

Sorry if the solution is working, I had two index.html. Thanks

arung-agamani commented 2 years ago

I think as long as you put window.DataStream = null somewhere on the beginning, it should work. You can put it before react is called on main.ts, for example.

trinayan98 commented 1 year ago

Uncaught ReferenceError: require is not defined ?????? for the local path