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.

AnnotationLayer error and not sure why that is

See original GitHub issue

Before you start - checklist

  • I followed instructions in documentation written for my React-PDF version
  • I have checked if this bug is not already reported
  • I have checked if an issue is not listed in Known issues
  • If I have a problem with PDF rendering, I checked if my PDF renders properly in Mozilla Firefox

React-PDF 5.2

Trying to display some Base64 PDF as a document, but getting this instead:

./node_modules/react-pdf/dist/esm/Page/AnnotationLayer.js 195:8-29
"export 'AnnotationLayer' (imported as 'pdfjs') was not found in 'pdfjs-dist'

followed by numerous other errors…

ERROR in ./node_modules/react-pdf/dist/esm/eventBus.js 2:19-27
15:26:11 webpack.1 | "export 'EventBus' was not found in 'pdfjs-dist/lib/web/ui_utils'

ERROR in ./node_modules/react-pdf/dist/esm/entry.webpack.js 14:2-27
15:26:11 webpack.1 | "export 'GlobalWorkerOptions' (imported as 'pdfjs') was not found in 'pdfjs-dist'

My setup code in my JSX file is:

import { Document } from 'react-pdf/dist/esm/entry.webpack';
import 'react-pdf/dist/Page/AnnotationLayer.css';

My Component looks like this:

<Document file={data:application/pdf;base64,${data}}>

What am I doing wrong to earn that message about AnnotationLayer and all the other problems?

My package.json shows yarn installed the package:

   "react-pdf": "^5.2.0",

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:14 (2 by maintainers)

github_iconTop GitHub Comments

6reactions
hornetDCcommented, Mar 11, 2021

@resistorsoftware you are not alone. I am also getting this error, but I don’t even import AnnotationLayer.css anywhere. Local development works but it breaks build.

Edit: it happens if I use “craco” to override CRA config.

// craco.config.js
const path = require('path');
const { getLoader, loaderByName } = require('@craco/craco');
const absolutePath = path.join(__dirname, '../uikit');

module.exports = {
  webpack: {
    alias: {},
    plugins: [],
    configure: (webpackConfig, { env, paths }) => {
      const { isFound, match } = getLoader(webpackConfig, loaderByName('babel-loader'));
      if (isFound) {
        const include = Array.isArray(match.loader.include)
          ? match.loader.include
          : [match.loader.include];
        match.loader.include = include.concat[absolutePath];
      }
      return webpackConfig;
    }
  }
};
3reactions
resistorsoftwarecommented, Mar 1, 2021

So no one else ever gets this error. I am not amused. How do I run into these kinds of issues… yay!! I figured out how to render a PDF without this node package. In the meantime… was hoping anyone had some advice about what might be causing this package to die this way.

Just double-checked and even when I think it could be due to something else, nope… still puzzled. Won’t compile at all.

ERROR in ./node_modules/react-pdf/dist/esm/Page/AnnotationLayer.js 195:8-29 09:35:23 webpack.1 | "export ‘AnnotationLayer’ (imported as ‘pdfjs’) was not found in ‘pdfjs-dist’

Read more comments on GitHub >

github_iconTop Results From Across the Web

Developers - AnnotationLayer error and not sure why that is -
Coming soon: A brand new website interface for an even better experience!
Read more >
Problem consuming Annotation Layer: "invalid response"
I'm trying to learn how to consume an "Annotation Layer" from the UWP ... this gives an error "invalid response" on the last...
Read more >
Annotation layer's feature class does not have a symbol stored ...
You are using a geodatabase annotation feature class that does not reference a symbol collection. This can potentially affect drawing performance because each ......
Read more >
Using annotation layer inside group layer without getting error ...
Draw something (e.g. freehand) - This does not work! You will get the error message "error adding element". You will now not be...
Read more >
Error message: Overflow in AnnotationLayer.Form_Load at line 146 ...
Since Presenter 09 isn't supported with Office 2016, I can't say for certain what is causing that error. If you're able to update...
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