Skip to content

Module Not Found: "process/browser" Error in React Integration with @fileforge/pdfreader #1

@ANYURU

Description

@ANYURU

I am experiencing an issue while integrating @fileforge/pdfreader into my React project. After following the documentation and installing the package, I encountered a Webpack compilation error related to the missing process/browser module.

Error Details:
The following error occurs during the build process:
Screenshot 2024-10-18 at 12 50 19

Additionally, I tried adding a polyfill for process in my Webpack configuration, but the error persists. The issue seems to be related to how the module is handled within @fileforge/pdfreader.

Steps to Reproduce:

  1. Install @fileforge/pdfreader in a React project.
  2. Attempt to import and use the component in the project.
  3. Run the build using Webpack (or a React build tool like Create React App).

Expected Behavior:
The package should work without requiring a manual polyfill for Node.js modules like process.

Actual Behavior:
The build fails with the error above.

Environment:

  • OS: macOS
  • Node.js version: v20.18.0 | v22.7.0
  • Webpack version: 5.64.4
  • React version: 18.3.1
  • @fileforge/pdfreader version: 0.1.43

Attempts to Resolve:
I attempted to resolve the issue by:

  • Installing the process polyfill.
  • Modifying the Webpack configuration to include process/browser.
  • Ensuring that the paths are correctly set in the module resolution.

Despite these attempts, the error persists, suggesting a deeper issue with how @fileforge/pdfreader handles dependencies.

Request:
Could you provide guidance on how to resolve this error, or update the package to avoid requiring manual Node.js polyfills when used in a browser environment like React? If possible, an example of proper integration would also be very helpful.

Thank you for your time and assistance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions