question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file

See original GitHub issue
ERROR  Failed to compile with 2 errors                                                                  12:58:23

 error  in ./node_modules/pdfjs-dist/build/pdf.js

Module parse failed: Unexpected token (2413:45)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
|         intent: renderingIntent,
|         renderInteractiveForms: renderInteractiveForms === true,
>         annotationStorage: annotationStorage?.getAll() || null
|       });
|     }

 @ ./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./src/views/sign/esign/AcEsign.vue?vue&type=script&lang=js& 122:0-41 493:6-17
 @ ./src/views/sign/esign/AcEsign.vue?vue&type=script&lang=js&
 @ ./src/views/sign/esign/AcEsign.vue
 @ ./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./src/views/sign/Home.vue?vue&type=script&lang=js&
 @ ./src/views/sign/Home.vue?vue&type=script&lang=js&
 @ ./src/views/sign/Home.vue
 @ ./src/router/index.js
 @ ./src/js/core/init.js
 @ ./src/main.js
 @ multi (webpack)-dev-server/client?http://192.168.43.252:8080&sockPath=/sockjs-node (webpack)/hot/dev-server.js ./src/main.js

 error  in ./node_modules/pdfjs-dist/web/pdf_viewer.js

Module parse failed: Unexpected token (895:20)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
|     this._on(eventName, listener, {
|       external: true,
>       once: options?.once
|     });
|   }

 @ ./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./src/views/sign/esign/AcEsignViewer.vue?vue&type=script&lang=js& 23:0-64 97:28-36 110:30-39
 @ ./src/views/sign/esign/AcEsignViewer.vue?vue&type=script&lang=js&
 @ ./src/views/sign/esign/AcEsignViewer.vue
 @ ./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./src/views/sign/esign/AcEsign.vue?vue&type=script&lang=js&
 @ ./src/views/sign/esign/AcEsign.vue?vue&type=script&lang=js&
 @ ./src/views/sign/esign/AcEsign.vue
 @ ./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./src/views/sign/Home.vue?vue&type=script&lang=js&
 @ ./src/views/sign/Home.vue?vue&type=script&lang=js&
 @ ./src/views/sign/Home.vue
 @ ./src/router/index.js
 @ ./src/js/core/init.js
 @ ./src/main.js
 @ multi (webpack)-dev-server/client?http://192.168.43.252:8080&sockPath=/sockjs-node (webpack)/hot/dev-server.js ./src/main.js



How can we resolve this issue??

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:17 (1 by maintainers)

github_iconTop GitHub Comments

32reactions
Snuffleupaguscommented, Apr 8, 2021

Vue Version “^2.6.11”,

Unfortunately “Vue”, whatever that is, isn’t something that the PDF.js contributors can support. Furthermore, there’s not really any actionable information provided as-is; please note https://github.com/mozilla/pdf.js/blob/master/.github/CONTRIBUTING.md (emphasis mine):

If you are developing a custom solution, first check the examples at https://github.com/mozilla/pdf.js#learning and search existing issues. If this does not help, please prepare a short well-documented example that demonstrates the problem and make it accessible online on your website, JS Bin, GitHub, etc. before opening a new issue or contacting us in the Matrix room – keep in mind that just code snippets won’t help us troubleshoot the problem.


error in ./node_modules/pdfjs-dist/build/pdf.js

You probably need to use the correct type of build then, as explained at https://www.npmjs.com/package/pdfjs-dist/v/2.7.570?activeTab=readme

For usage with older browsers or environments, without support for modern features such as e.g. async/await, ReadableStream, optional chaining, and nullish coalescing; please see the es5 folder.

27reactions
davidbsteincommented, Sep 27, 2021

Since this is the first search result for the error message and the solution isn’t in the thread…

Symptom: The following error message shows up when you build.

You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file

Cause: your build configuration does not support option chaining. Likely something with webpack or babel.

Solution 1: the quick fix is to use the legacy build folder.

// If this causes an error:
import * as PDFJSViewer from "pdfjs-dist/web/pdf_viewer";
import {getDocument } from "pdfjs-dist/build/pdf.js";

// use this instead:
import * as PDFJSViewer from "pdfjs-dist/legacy/web/pdf_viewer";
import {getDocument } from "pdfjs-dist/legacy/build/pdf.js";

Solution 2: Change your webpack configuration to support option chaining by installing @babel/preset-env or following the instructions in the comments earlier in this thread.

Read more comments on GitHub >

github_iconTop Results From Across the Web

"You may need an appropriate loader to handle this file type ...
Step-2: In order to compile JSX code to es5 babel provides @babel/preset-react package to convert react jsx extension file to native browser ...
Read more >
You may need an appropriate loader to handle this file type ...
I 'm having a problem configuring Webpack for Typescript and React. ... file type currently no loaders are configured to process this file....
Read more >
Module parse failed: Unexpected token. You may ... - GitHub
Module parse failed: Unexpected token. You may need an appropriate loader to handle this file type, currently no loaders are configured to process...
Read more >
You may need an appropriate loader to handle ... - Laracasts
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. Hello,. I allow...
Read more >
CSS : You may need an appropriate loader to handle this file ...
CSS : You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found