Company logo
  • Empleos
  • Bootcamp
  • Acerca de nosotros
  • Para profesionales
    • Inicio
    • Empleos
    • Cursos y retos
    • Preguntas
    • Profesores
    • Bootcamp
  • Para empresas
    • Inicio
    • Nuestro proceso
    • Planes
    • Pruebas
    • Nómina
    • Blog
    • Comercial
    • Calculadora

0

79
Vistas
How to find unused images in public folder in react app

i have a big project with a lot of images in the public folder of react app, is there a way to find all the unused images and clean them up ?

7 months ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

This is a common issue and this question led to me to search for answers. I stumbled upon this video which helped to partly resolve the issue.

The problem here is that, the plugin used in the video unused-files-webpack-plugin does not support Webpack 5. An issue was raised to update the plugin to support Webpack 5 but the author of the package hasn't issued an update.

A similar package that can be used is the webpack-deadcode-plugin. You can use the implementation from the video and substitute the unused-files-webpack-plugin with the webpack-deadcode-plugin making a few changes (such as to the patterns property which you would have to change to something like: patterns: ['src/**/*.(png|jpg|jpeg)'] for your use case) to adapt the new plugin.

Edit: This answer assumes you are using webpack as your bundler.

7 months ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos