Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Missing "./package.json" export in "react-pdf" package #1876

Closed
4 tasks done
badasukerubin opened this issue Sep 13, 2024 · 0 comments
Closed
4 tasks done

Error: Missing "./package.json" export in "react-pdf" package #1876

badasukerubin opened this issue Sep 13, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@badasukerubin
Copy link

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 PDF.js demo

Description

I encounter this error when I build the host using module federation.

Steps to reproduce

  • Configure the remote micro-frontend (import from react-pdf as described in the doc into the component)
  • Expose the component. Sample vite.config.ts:
     federation({
           name: "remote",
           filename: "remoteEntry.js",
           exposes: {
               "./ReactPdfViewer":
                   "./resources/js/ReactPdfViewer",
           },
           shared: ["react", "react-dom", "@react-pdf-viewer/core"],
       }),
  • Configure the host application. Sample vite.config.ts:
 federation({
      name: 'host',
      remotes: {
        remote:
          'http://localhost:5004/public/build/assets/remoteEntry.js',
      },
      shared: [
        'react',
        'react-dom',
        'react-pdf',
      ],
    }),
  • Run build on the host application

Expected behavior

The build should run successfully on both the remote and host applications, and we should be able to import the ReactPdfViewer component.

Actual behavior

The build process fails on the host application with the error: Error: Missing "./package.json" export in "react-pdf" package

Additional information

No response

Environment

  • Browser (if applicable):
  • React-PDF version: ^9.1.0
  • React version: ^18.2.0
  • Bundler name and version (if applicable): Vite => ^3.2.7, "@originjs/vite-plugin-federation": "^1.3.5",
@badasukerubin badasukerubin added the bug Something isn't working label Sep 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant