Caliga's avatar

Laravel Mix - Adding Webpack SVGStore plugin

Hello!

I'm migrating my boilerplate from 5.3 to 5.4. My gulpfile relies heavily on svgstore and svgmin, and I'm looking to integrate this webpack plugin into mix:

https://www.npmjs.com/package/webpack-svgstore-plugin

Would any of you have an idea on how to do this?

My mixfiles as it stands:

const { mix }  = require('laravel-mix');
const svgstore = require('webpack-svgstore-plugin');

mix
    .webpackConfig({
        plugins: [
            new svgstore({
                svgoOptions: {
                    plugins: [
                        {
                            removeTitle: true
                        },
                    ]
                },
                svg: {
                    style: 'display: none;',
                },
                prefix: 'icon_',
                name: 'icons.svg',
            })
        ]
    })
    .js('resources/assets/js/app.js', 'public/js')
    .sass('resources/assets/sass/app.scss', 'public/css')
    .sourceMaps();

Thanks!

0 likes
1 reply
willvincent's avatar

Might be easier to copy the default webpack config file out of the laravel mix node module and override it than trying to shove in all the requisite config this way.

Please or to participate in this conversation.