How to combine asset-modules with other loaders in webpack

Viewed 18

In webpack v5 we are recommended to use asset modules instead of loaders like url-loader. But how do I combine asset modules with other loaders? I have a typescript file that I would like to process with babel or ts-loader and then import into another file as a data url. I believe I could do this with url-loader with something like

module.exports = {
    ...
    module: {
        rules: [
            {
                test: /my-file.ts/,
                use: ['url-loader', 'ts-loader'],
            },
        ],
    },
}

But I understand that url-loader is deprecated.

0 Answers
Related