webpack-contrib / file-loader

File Loader
MIT License
1.86k stars 257 forks source link

How to load SVG images? #319

Closed UlpiusCode closed 5 years ago

UlpiusCode commented 5 years ago

How I can load SVG images in html and background: url()?

Thanks a lot!

alexander-akait commented 5 years ago
module.exports = {
  module: {
    rules: [
      {
        test: /\.(png|jpg|gif|svg)$/,
        use: [
          {
            loader: 'file-loader',
            options: {},
          },
        ],
      },
    ],
  },
};

Also it is bug tracker, not QA service, please use stackoverflow or gitter for questions, thanks

UlpiusCode commented 5 years ago

Ok, this rules is for "png, jpg, gif", but for svg? I can use file-loader foar loading svg images? if not then what can I use?

alexander-akait commented 5 years ago

@UlpiusCode i fixed snippet above, just add svg in list