react-doc-viewer icon indicating copy to clipboard operation
react-doc-viewer copied to clipboard

Unable to render doc from https URL

Open deepakarumugham opened this issue 2 years ago • 6 comments

Unable to render doc from https URL

Whilre trying to load a docx file via a signed url, it throws the below Exception:

Failed to compile.

./node_modules/pdfjs-dist/build/pdf.js 389:20
Module parse failed: Unexpected token (389:20)
You may need an appropriate loader to handle this file type.
|       }
|       function _isValidProtocol(url) {
>         switch (url?.protocol) {
|           case "http:":
|           case "https:":
Screenshot

Anyways to resolve this issue.

deepakarumugham avatar Jan 08 '24 06:01 deepakarumugham

can share more information about that

SidWML avatar Jan 12 '24 09:01 SidWML

encountered the same issue. the issue should be resolved by upgrading webpack to 5 or using babel/plugin-proposal-optional-chaining. I used the latter one, it worked for me

FX-HAO avatar Jan 26 '24 04:01 FX-HAO

Getting the same one and also tried upgrading the webpack. But didn't work.

Any other solution?

avichovatiya67 avatar Mar 22 '24 11:03 avichovatiya67

this is a CORS issue the urls should be public

SidWML avatar Mar 22 '24 11:03 SidWML

I am displaying Blob file

Here is the error that I am facing.

Failed to compile.

./node_modules/pdfjs-dist/build/pdf.js 389:20
Module parse failed: Unexpected token (389:20)
File was processed with these loaders:
 * ./node_modules/babel-loader/lib/index.js
You may need an additional loader to handle the result of these loaders.
|       }
|       function _isValidProtocol(url) {
>         switch (url?.protocol) {
|           case "http:":
|           case "https:":

avichovatiya67 avatar Mar 22 '24 11:03 avichovatiya67

/node_modules/pdfjs-dist/build/pdf.js 389:22 Module parse failed: Unexpected token (389:22) File was processed with these loaders:

  • ./node_modules/babel-loader/lib/index.js You may need an additional loader to handle the result of these loaders. | } | function _isValidProtocol(url) {
      switch (url?.protocol) {

| case "http:": | case "https:": i am also facing same issue

ArjunSoftobiz avatar May 29 '24 07:05 ArjunSoftobiz