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

172
Vistas
Syntax in crac-webpack-rewired to solve webpack polyfills error

I created my project in React using create-react-app, but after sometime I got to this error in the console

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: { "path": require.resolve("path-browserify") }'
\- install 'path-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "path": false }
@ ./node_modules/loader-utils/lib/index.js 7:25-54
@ ./node_modules/file-loader/dist/index.js 11:19-42
@ ./node_modules/file-loader/dist/cjs.js 3:15-33
@ ./src/App.js 13:0-35
@ ./src/index.js 7:0-24 11:33-36

After reading this post, I reached the conclusion I had to modify the webpack.config.js that I did not have because I created the project with create-react-app. Instead of ejecting (it is not very recommended), I used the npm package advised at the end of this thread. The problem is that there are no examples on how to use it. My question is which syntaxis do I have to follow to modify config/webpack.extend.js? This is the code at the moment:

module.exports = {
    dev: (config) => {
        //override webpack configuration
        config.externals =[..];
        return config;
    },
    prod: (config) => {
        //override webpack configuration
        config.externals =[..];
        return config;
    }
};

I have tried using console.log(config) but it never gets to print as errors are printed back.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You cannot use console.log() because that code is not executed from the browser, but in the Webpack "compilation" phase.

This could be a possible solution for your case.

module.exports = {
    dev: (config) => {
      //override webpack configuration
      config.resolve.fallback = {"path": require.resolve("path-browserify")};
      return config;
    },
    prod: (config) => {
      //override webpack configuration
      config.resolve.fallback = {"path": require.resolve("path-browserify")};       
      return config;
    }
}

Notice that you have to install the package path-browserfy.

You can also set the path property to false.

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