How do I correctly use inline-svg-loader for webpack2?

306 Views Asked by At

I set it up in my modules and it builds without error, however, my svg's end up looking like this: enter image description here

and upon inspection it looks like the module inlines the svg in the img's src-attribute: enter image description here

How can I make this loader inline my svg's correctly?

My webpack.config.js file looks like this:

module.exports ={
    entry: './template.html',
    output: {
        path: path.resolve(__dirname),
        filename: "index.html",
    },
    module: {
        rules: [
            {
                test: /\.css$/,
                use:[
                    'style-loader',
                    'css-loader',
                    'font-loader?format[]=truetype&format[]=woff&format[]=embedded-opentype'
                ]
            },
            {
                test: /\.html$/,
                use:[
                    'html-loader'
                ]
            },
            {
                test: /\.svg$/,
                loader: 'svg-inline-loader'
            },
            {
                test: /\.(jpg|png)$/,
                use:[
                    {
                        loader: 'file-loader',
                        options: {
                            name: '[name].[ext]',
                        }
                    }
                ]
            }
        ]

    },
    plugins: [
        new htmlWebpackPlugin({
            template: 'template.html'
        })
    ]
}; 
0

There are 0 best solutions below