Ignoring files in Webpack

People tend to whine a lot about the documentation of Webpack; while I agree that it could be better, the thing is open source so if you want to help out just do it! One question however seems to be very poorly answered on the internet and my colleagues (and others) keep asking it; how do you simply ignore files?

You might have seen tons of warnings like “You may need an appropriate loader to handle this file type.” popping up when you run Webpack and you might want to get rid of them without doing what Webpack suggests; add a specific loader for all of them.

While this might mean you need more studying of how to use Webpack, often people get blocked for hours or even days(!) by searching for a quickfix(-and-we’ll-change-it-when-needed); that quick fix is;


npm install --save-dev ignore-loader

after which you can add;


loaders: [
{test: /\.(jpe?g|png|gif|svg|map|css|std|indent|html|txt)$/i,
loader: 'ignore-loader'},

Comments are closed.