webpack5 asset module - [DEP_WEBPACK_MODULE_ISSUER] DeprecationWarning: Module.issuer: Use new ModuleGraph API

Viewed 19
// webpack image rule
{
  test: /\.(png|jpe?g|gif|bpm|svg|webp)(\?.*)?$/,
  type: 'asset',
  parser: {
    dataUrlCondition: function (source, { module }) {
      if (/\.less|vue&type=style/.test(module.issuer.resource)) {
        return true
      }
      return source.length < 8092
    }
  },
  ...
},

runing the config, I get this:

[DEP_WEBPACK_MODULE_ISSUER] DeprecationWarning: Module.issuer: Use new ModuleGraph API

it means need change code: module.issuer.resource => compilation.moduleGraph.getIssuer(module).resource.

but parser.dataUrlCondition type is (source: Buffer, { module: Module, filename: string}) => boolean

if there a way to get current compilation that contain moduleGraph property?

0 Answers
Related