Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

221
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda