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.

node packge pdfjs-dist@2.6.347 syntax error

See original GitHub issue

Configuration:

  • PDF.js version: 2.6.347

Steps to reproduce the problem:

  1. npm install pdfjs-dist@2.6.347
  2. At node_modules/pdfjs-dist/build/pdf.js line 2413 you will get this: annotationStorage: annotationStorage?.getAll() || null, and this is definitely a syntax error.
  3. However the cdn version works fine, https://cdn.jsdelivr.net/npm/pdfjs-dist@2.6.347/build/pdf.js

A lot of same errors found at line 2771, line 2817, line 2907, line 2934, line 3488, line 3543, line 3653, line 3744 .etc

Issue Analytics

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

github_iconTop GitHub Comments

5reactions
dsilvestregilcommented, Jun 18, 2021

@Snuffleupagus This import doesn’t work for me. Folder ‘es5’ not exists in node_modules

3reactions
Snuffleupaguscommented, Apr 8, 2021

Once more: The answer was already provided in https://github.com/mozilla/pdf.js/issues/13190#issuecomment-814701619, and it means that you’ll need to import from node_modules/pdfjs-dist/es5/build/pdf.js[1] instead.


[1] Or node_modules/pdfjs-dist/legacy/build/pdf.js, when using PDF.js version 2.8.335 and above.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Looking for help to make npm/pdfjs-dist work with Webpack ...
This issue seems to arise due to esModule option introduced in worker-loader@3.0.0 . The fix for this was merged in (pre-release) ...
Read more >
pdfjs-dist - npm
Our goal is to create a general-purpose, web standards-based platform for parsing and rendering PDFs. This is a pre-built version of the PDF.js...
Read more >
Solved: Problem with pdfjs-dist on build - Alfresco Hub
Solved: Hi, when we try to build (npm run-script build:dist ... ERROR in scripts.9d7058f51ab079a5b4f2.js from Terser Unexpected token: punc ...
Read more >
Compile and set the worker source with Webpack
Otherwise, you you will see the error message like this: ... Where `2.6.347` is the version of `pdfjs-dist` that you can see in...
Read more >
pdfjs-dist - UNPKG
... /@babel/runtime/regenerator/index.js","webpack://pdfjs-dist/build/pdf/node_modules/@babel/runtime/node_modules/regenerator-runtime/runtime-module.js" ...
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