{"id":14629,"library":"ignore-loader","title":"Webpack Ignore Loader","description":"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.","status":"abandoned","version":"0.1.2","language":"javascript","source_language":"en","source_url":"https://github.com/cherrry/ignore-loader","tags":["javascript"],"install":[{"cmd":"npm install ignore-loader","lang":"bash","label":"npm"},{"cmd":"yarn add ignore-loader","lang":"bash","label":"yarn"},{"cmd":"pnpm add ignore-loader","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Required for the loader to function within a Webpack build process. It's an implicit peer dependency.","package":"webpack","optional":false}],"imports":[{"note":"Loaders are referenced as string values in the `webpack.config.js` configuration file, specifically within the `module.loaders` array for older Webpack versions (1-3). They are not imported into JavaScript application code directly.","wrong":"import ignoreLoader from 'ignore-loader'; // Loaders are referenced as strings in webpack.config.js, not imported as modules\nrequire('ignore-loader'); // Not how loaders are consumed","symbol":"'ignore-loader'","correct":"module: { loaders: [{ test: /\\.css$/, loader: 'ignore-loader' }] }"},{"note":"This loader is designed for Webpack 1-3's `module.loaders` configuration. Modern Webpack (4+) uses `module.rules` and `use` for loaders, which is not compatible with this package's intended usage.","wrong":"module: {\n  rules: [\n    { test: /\\.(png|jpg|gif)$/, use: ['ignore-loader'] }\n  ]\n} // 'rules' and 'use' are for Webpack 4+; this loader uses 'loaders' and 'loader'","symbol":"Loader configuration (Webpack 1-3)","correct":"module: {\n  loaders: [\n    { test: /\\.(png|jpg|gif)$/, loader: 'ignore-loader' }\n  ]\n}"}],"quickstart":{"code":"/* webpack.config.js (for Webpack 1-3) */\n\nmodule.exports = {\n  entry: './src/index.js',\n  output: {\n    filename: 'bundle.js',\n    path: require('path').resolve(__dirname, 'dist'),\n  },\n  module: {\n    // This loader configuration is for Webpack versions 1, 2, or 3.\n    // It will prevent any .css files from being processed or bundled.\n    // They will effectively be ignored during the build.\n    loaders: [\n      { \n        test: /\\.css$/,\n        loader: 'ignore-loader'\n      },\n      // Example for ignoring specific images as well\n      {\n        test: /\\.(png|jpg|gif)$/,\n        include: require('path').resolve(__dirname, 'src/assets/ignored-images'),\n        loader: 'ignore-loader'\n      }\n    ]\n  },\n  // For Webpack 4+, 'module.rules' is used instead of 'module.loaders'.\n  // This loader is not recommended for modern Webpack versions.\n};","lang":"javascript","description":"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."},"warnings":[{"fix":"Migrate your Webpack configuration to use `module.rules` and `use` property, or find an alternative method for ignoring modules that is compatible with modern Webpack. For example, `null-loader` or `raw-loader` with an empty string return can achieve similar results in `module.rules`.","message":"The `module.loaders` configuration array used by `ignore-loader` was deprecated in Webpack 2 and completely removed in Webpack 4. Using this loader or its configuration style with Webpack 4 or newer will result in configuration errors.","severity":"breaking","affected_versions":">=4.0.0"},{"fix":"Ensure that files ignored by `ignore-loader` are also not referenced by your application code, or implement conditional imports/requires that check for environment variables (e.g., `process.env.NODE_ENV === 'test'`).","message":"`ignore-loader` effectively removes the content of matched files from the bundle, but it does not remove references to those files in your source code. If your application code still attempts to import or use the ignored assets, it might lead to runtime errors (e.g., `Module not found`) if a subsequent loader or runtime expects the asset to be present.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Consider migrating to alternative solutions or a custom loader if you need similar functionality in a modern Webpack setup. Relying on abandoned packages can introduce security risks and compatibility issues in the long term.","message":"This package is abandoned. Its last publish was 9 years ago (as of April 2026), and there has been no significant activity on its GitHub repository since 2017. It is not maintained, and there are no plans for updates or compatibility with newer Webpack versions.","severity":"deprecated","affected_versions":">=0.1.0"}],"env_vars":null,"last_verified":"2026-04-19T00:00:00.000Z","next_check":"2026-07-18T00:00:00.000Z","problems":[{"fix":"Update your Webpack configuration to use `module.rules` instead of `module.loaders`. This `ignore-loader` package is specifically for older Webpack versions and will not work with `module.rules` directly without an adapter or wrapper.","cause":"Using `module.loaders` (an older Webpack configuration syntax) in Webpack version 4 or newer.","error":"ERROR in Configuration has an unknown property 'loaders'. These properties are valid: ..."},{"fix":"Ensure `ignore-loader` is only referenced as a string within the `module.loaders` array of your `webpack.config.js` (for Webpack 1-3). Loaders are processing steps, not modules to be imported into your application's runtime.","cause":"Attempting to `require()` or `import` `ignore-loader` directly into JavaScript code, or using it incorrectly in `webpack.config.js` for an older Webpack version where the loader itself fails to transform the module.","error":"Module parse failed: Unexpected token (1:0) You may need an appropriate loader to handle this file type..."}],"ecosystem":"npm"}