web-infra-dev / rspack

The fast Rust-based web bundler with webpack-compatible API 🦀️
https://rspack.dev
MIT License
10.04k stars 573 forks source link

[Feature]: Module.parser.asset.dataUrlCondition support function #8488

Open GiveMe-A-Name opened 2 days ago

GiveMe-A-Name commented 2 days ago

What problem does this feature solve?

Currently, Rspack config.module.parser.asset.dataUrlCondition only support object. We can't compute the dataUrlCondition.maxSize by function.

What does the proposed API of configuration look like?

Align webpack, Module.parser.asset.dataUrlCondition support function.

module.exports = {
  module: {
    parser: {
      asset: {
        dataUrlCondition: (source, { filename, module }) => {
          return condition(source)
        }
      },
    },
  },
};
inottn commented 1 day ago

If no one else is working on it, I can give it a try.

GiveMe-A-Name commented 1 day ago

If no one else is working on it, I can give it a try.

Yes, you can. Thanks your contribution firstly.