Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

4jZW7jVSdS4U6PC's avatar

How to load a custom loader in laravel-mix?

I was reading the doc for Webpack configuration but I'm still not sure on how to load a custom loader, for example I would like to use stylus without editing the config file, is that possible using the mix.webpackConfig() function?

Thank you in advance

0 likes
4 replies
gborcherds's avatar
Level 4

Yes, that's all you need to do.

mix.webpackConfig({
    module: {
    loaders: [{
            test: /\.styl$/,
            loader: 'css-loader!stylus-loader?paths=node_modules/bootstrap-stylus/stylus/'
     }]
    }
});

Something like that should work, I didn't test it though.

5 likes

Please or to participate in this conversation.