Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compiling RuleSet failed: Properties mimetype are unknown #458

Closed
jpvanhal opened this issue Jun 5, 2021 · 1 comment
Closed

Compiling RuleSet failed: Properties mimetype are unknown #458

jpvanhal opened this issue Jun 5, 2021 · 1 comment

Comments

@jpvanhal
Copy link

jpvanhal commented Jun 5, 2021

Do you want to request a feature, report a bug or ask a question?

Bug

What is the current behavior?

Using SpriteLoaderPlugin together with Rule.mimetype results in the error:

Error: Compiling RuleSet failed: Properties mimetype are unknown (at ruleSet[0].rules[0]: [object Object])
    at RuleSetCompiler.error (./node_modules/webpack/lib/rules/RuleSetCompiler.js:373:10)
    at RuleSetCompiler.compileRule (./node_modules/webpack/lib/rules/RuleSetCompiler.js:196:15)
    at ./node_modules/webpack/lib/rules/RuleSetCompiler.js:154:9
    at Array.map (<anonymous>)
    at RuleSetCompiler.compileRules (./node_modules/webpack/lib/rules/RuleSetCompiler.js:153:16)
    at RuleSetCompiler.compileRule (./node_modules/webpack/lib/rules/RuleSetCompiler.js:184:30)
    at ./node_modules/webpack/lib/rules/RuleSetCompiler.js:154:9
    at Array.map (<anonymous>)
    at RuleSetCompiler.compileRules (./node_modules/webpack/lib/rules/RuleSetCompiler.js:153:16)
    at RuleSetCompiler.compile (./node_modules/webpack/lib/rules/RuleSetCompiler.js:68:22)
    at module.exports (./node_modules/svg-sprite-loader/lib/utils/get-matched-rule-5.js:45:37)
    at SVGSpritePlugin.apply (./node_modules/svg-sprite-loader/lib/plugin.js:61:18)
    at createCompiler (./node_modules/webpack/lib/webpack.js:74:12)
    at create (./node_modules/webpack/lib/webpack.js:123:16)
    at webpack (./node_modules/webpack/lib/webpack.js:131:47)
    at WebpackCLI.f [as webpack] (./node_modules/webpack/lib/index.js:54:15)

What is the expected behavior?

No errors.

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.

webpack.config.js:

const SpriteLoaderPlugin = require('svg-sprite-loader/plugin');

module.exports = {
  mode: 'development',
  module: {
    rules: [
      {
        mimetype: 'application/json',
        type: 'json',
      },
      {
        test: /\.svg$/,
        loader: 'svg-sprite-loader',
      },
    ],
  },
  plugins: [new SpriteLoaderPlugin()],
};

Please tell us about your environment:

  • Node.js version: 14.16.0
  • webpack version: 5.36.2
  • svg-sprite-loader version: 6.0.7
  • OS type & version: macOS 11.4

Other information (e.g. detailed explanation, stacktraces, related issues, suggestions how to fix, links for us to have context, eg. stackoverflow, gitter, etc)

This is very similar to #428 and the fix is also similar. In /lib/utils/get-matched-rule-5.js:

const ruleSetCompiler = new RuleSetCompiler([
  // ...
  new BasicEffectRulePlugin('mimetype'),   // add this
  // ...
]);
@jpvanhal
Copy link
Author

Fixed by #460.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant