Webpack 5 and null-loader-esque functionality

Viewed 663

Webpack 5 deprecated null-loader, which was helpful for excluding certain imports from client-side bundles. Now, the docs say that I should use the resolve.alias option with false instead, however, this thing doesn't accept regex keys like null-loader did. But I want to deliberately exclude specific imports matching a regex. I've tried IgnorePlugin, but that simply prevents the module from being added to the bundle but keeps the import, which breaks in the browser.

What's the intended solution here? Should I write my own loader to do what null-loader used to do?

1 Answers
Related