Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

598
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar

0

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

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda