Webpack Ignore Loader

0.1.2 · abandoned · verified Sun Apr 19

ignore-loader is a Webpack loader designed to prevent specified files from being processed and bundled by Webpack. It achieves this by essentially replacing the content of matched modules with an empty string, effectively omitting them from the final build output. First published 9 years ago and last updated in 2017 (version 0.1.2), it is considered an abandoned package. This loader is primarily relevant for older Webpack configurations (versions 1-3) that utilized the `module.loaders` array syntax, as modern Webpack (versions 4+) uses `module.rules`. It doesn't receive new features or bug fixes, and its utility is largely superseded by more flexible configuration options or newer community loaders.

Common errors

Warnings

Install

Imports

Quickstart

Demonstrates configuring `ignore-loader` in an older Webpack `webpack.config.js` to prevent CSS and specific image files from being bundled. This configuration utilizes the `module.loaders` syntax specific to Webpack versions 1-3.

/* webpack.config.js (for Webpack 1-3) */

module.exports = {
  entry: './src/index.js',
  output: {
    filename: 'bundle.js',
    path: require('path').resolve(__dirname, 'dist'),
  },
  module: {
    // This loader configuration is for Webpack versions 1, 2, or 3.
    // It will prevent any .css files from being processed or bundled.
    // They will effectively be ignored during the build.
    loaders: [
      { 
        test: /\.css$/,
        loader: 'ignore-loader'
      },
      // Example for ignoring specific images as well
      {
        test: /\.(png|jpg|gif)$/,
        include: require('path').resolve(__dirname, 'src/assets/ignored-images'),
        loader: 'ignore-loader'
      }
    ]
  },
  // For Webpack 4+, 'module.rules' is used instead of 'module.loaders'.
  // This loader is not recommended for modern Webpack versions.
};

view raw JSON →