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

212
Vistas
Webpack 5 IgnorePlugin - Not ignoring JS file from output on CSS files only?

I am trying to use the Webpack's IngorePlugin. I am using my Webpack file only to create a CSS file. On build, it outputs a JS file. But I don't want that. Tried ignoring JS files but still outputs it.

new webpack.IgnorePlugin(/^\.\/js\/(?!admin)/),

Outputs in the ROOT folder. So I want to disable all JS files from the output in the root folder. "admin" is the file being created.

How can I do this?

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

0

To properly answer your question, it'd be helpful if you posted a link to the full WP config file and an example of the file that's being processed.

Also, you mentioned you're only using WP to create a CSS file, does that mean you're just trying to use something like SASS, Stylus, Less, etc? If so, you could probably just set up a package.json script to compile your CSS without WP.
For example, if you have a .scss file, you could install node-sass, and create a simple Node script to compile what file you pass in as an arg.

bin/
  - build-css.js
src/
  - styles.sass

Within build-css.js

#!/usr/bin/env node

const { basename, resolve } = require('path');
const sass = require('node-sass');

const [...files] = process.argv.slice(2);

if (files.length) {
  files.forEach((relativeFilePath) => {
    const fileName = basename(relativeFilePath, '.scss');
    
    sass.render(
      {
        file: resolve(__dirname, relativeFilePath),
        outFile: resolve(__dirname, `./public/css/${fileName}.css`),
      },
      (err, result) => { console.log(err); }
    );
  });
}
else {
  console.log('No files were provided to process');
}

Within package.json

"scripts": {
  "build:css": "node ./bin/build-css.js"
}

The above has the benefit of giving you the control of how your files are processed at a more granular level, and you're only locked in to any SCSS changes, instead of Webpack and SCSS.

If you're using WP for it's file watching capabilities, you could instead wire up chokidar to run the new script when you change files.

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