Skip to content

"Compiling RuleSet failed: Properties generator are unknown" error #428

@shameleo

Description

@shameleo

Do you want to request a feature, report a bug or ask a question?
Bug
What is the current behavior?
When I use webpack 5 Asset Modules feature and svg-sprite-loader at the same time I get error mentioned in title.
If the current behavior is a bug, please provide the steps to reproduce, at least part of webpack config with loader configuration and piece of your code.

module: {
    rules: [
        // ...
        {
            test: /\.(woff|jpg|png|gif)$/,
            type: 'asset/resource',
            generator: {
                filename: `assets/[name]${bldHash}.[ext]`
            }
        },
        {
            test: /\.svg$/,
            loader: 'svg-sprite-loader',
            options: {
                extract: true,
                // ...
            }
        }
    ]
},

Please tell us about your environment:

  • Node.js version: v12.18.3
  • webpack version: 5.11.1
  • svg-sprite-loader version: 5.2.1

Other information
Related issue: vuejs/vue-loader#1729
Fix is really simple:
/lib/utils/get-matched-rule-5.js

const ruleSetCompiler = new RuleSetCompiler([
  // ...
  new BasicEffectRulePlugin('generator'),   // add this
  // ...
]);

It worked for me. Anyway, I have no idea, what I'm doing (why loader depends on options which are not even related to it?), so I'd like not to create PR and let you to fix it consciousnessly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions