G
G
GaserV2019-02-17 11:18:36
webpack
GaserV, 2019-02-17 11:18:36

How to differentiate webpack loaders?

Such situation. There are svg icons. And I need to make it so that if the import of the icon goes to less - then use url-loader for example, and if in tsx - then @svgr/webpack; How can I do that?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
GaserV, 2019-02-17
@GaserV

For those who are interested, I solved the problem like this:

{
                test: /\.svg$/,
                use: ['@svgr/webpack'],
                issuer: {
                    include: /\.tsx$/,
                    exclude: /\.less?$/,
                },
            },
            {
                test: /\.svg/,
                use: {
                    loader: 'svg-url-loader',
                    options: {},
                },
                issuer: {
                    include: /\.less$/,
                    exclude: /\.tsx?$/,
                },
            },

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question