MMF-FE / svgicon

SVG icon components and tool set
https://mmf-fe.github.io/svgicon
MIT License
922 stars 95 forks source link

Laravel mix configuration #197

Open el-jacko opened 2 years ago

el-jacko commented 2 years ago

Hi, i'm using this plugin successfully in one of my vue projects. Now i'm trying to use it in an Laravel project. But it's not working, an svg element is added to the code but it's empty. Furthermore, the used svg files are copied in to the public folder, but there is js inside of the svg files ...

I added the following to my webpack.mix.js:

mix.webpackConfig({
    module: {
        rules: [
            {
                test: /\.svg$/,
                include: [svgFilePath],
                use: [
                    {
                        loader: '@yzfe/svgicon-loader',
                        options: {
                            svgFilePath: [svgFilePath],
                            svgoConfig: null
                        }
                    }
                ]
            }
        ]
    },
...
})
mix.options({
    vue: {
        transformAssetUrls: {
            ['v2-icon']: 'data'
        }
    }
})

Does anyone has this plugin running with laravel mix?