Alcumus/react-doc-viewer

Uncaught ReferenceError: DataStream is not defined

Opened this issue · 7 comments

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

Same error here :/

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

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>```

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

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

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.

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