Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

596
Views
Buffer is not defined in react-pdf

I try to use the react-pdf library to generate pdf.

But when I do this I have an error like this :

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to: - add a fallback 'resolve.fallback: { "assert": require.resolve("assert/") }' - install 'assert' If you don't want to include a polyfill, you can use an empty module like this: resolve.fallback: { "assert": false } resolve 'assert' in 'C:\Users\SMAX\OneDrive\Projets Autres\exxotax_react\node_modules\browserify-zlib\lib'

Now, after installing some packages the React/Webpack is compiled from npm run start. But I have the following error :

Buffer is not defined And nothing appear on screen.

How can I fix it ? I tried :

  • Install all libraries needed
  • Watch on internet some solution

The only solution I saw was somethin like :

Creating a webpack.config.js and add :

resolve: {
extensions: [ '.ts', '.js' ],
fallback: {
    "stream": require.resolve("stream-browserify"),
    "buffer": require.resolve("buffer")
} },

But how can I add this lines in the config file ? Do I need a new config file/package.json ? If yes how can I do ?

Thanks a lot !

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

To extend create-react-app webpack config, you will need to use craco or rewired instead of react-scripts

Craco: https://github.com/gsoft-inc/craco

Rewired: https://github.com/timarney/react-app-rewired

about 4 years ago · Juan Pablo Isaza Report

0

I finally updated all packages and use a workaorund because of a "conflict" with webpack.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!