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

216
Vistas
Remove js and css scripts based on pattern using webpack 5

Does anyone know of something similar to the below webpack plugin but compatible with webpack 5?

https://www.npmjs.com/package/html-webpack-plugin-remove

I simply need to remove scripts and css that follow a certain pattern but using a webpack 5 build.

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

0

In Webpack 5, on-build-webpack plugin did not work for me.

I found this:

Webpack Shell Plugin Next

In the project I’m working on we’re using Webpack 5 as a build tool for a CSS pattern library. Therefore, we didn’t need the main.js in our dist.

Run npm i -D webpack-shell-plugin-next

Then in webpack.config.ts (just showing the pertinent parts):

import WebpackShellPluginNext from "webpack-shell-plugin-next";

module.exports = {
    output: {
        path: path.resolve(__dirname, "static/dist")
    },
    plugins: [
        // Run commands before or after webpack 5 builds:
        new WebpackShellPluginNext({
            onBuildEnd: {
                scripts: [
                    () => {
                        fs.unlinkSync(path.join(config.output.path, "main.js"));
                    }
                ]
            }
        })
    ]
};

export default config;
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