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

SvgSpriteLoader is trying to guess you are using webpack 4 or 5 #493

Open
alivedise opened this issue Jul 20, 2022 · 1 comment
Open

SvgSpriteLoader is trying to guess you are using webpack 4 or 5 #493

alivedise opened this issue Jul 20, 2022 · 1 comment

Comments

@alivedise
Copy link

Do you want to request a feature, report a bug or ask a question?
Bug
What is the current behavior?
In my environment I am using monorepo with some package using webpack 4 and some webpack 5.

See https://github.com/JetBrains/svg-sprite-loader/blob/master/lib/utils/get-matched-rule-4.js#L4

It seems svg-sprite-loader is trying to access 'webpack/lib/RuleSet' to see the user is having webpack 4(w/ RuleSet) or webpack 5(w/o RuleSet), but this is not 100% true in monorepo environment.

In this case when using SvgSpriteLoader/plugin to build, an error will show as

Error: Rule can only have one resource source
What is the expected behavior?
Maybe we should be able to let the user to choose different version of the plugin for webpack 4 or webpack 5 instead of doing a strange internal "guess".

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.
The best way is to create repo with minimal setup to demonstrate a problem (package.json, webpack config and your code).
It you don't want to create a repository - create a gist with multiple files

If this is a feature request, what is motivation or use case for changing the behavior?

Please tell us about your environment:

  • Node.js version: ?
    14
  • webpack version: ?
    5.73.0 in a monorepo where has webpack 4.46.0 as well
  • svg-sprite-loader version: ?
    6.0.11
  • OS type & version: ?
    mac

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

@TomorrowLM
Copy link

14.17.0

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

No branches or pull requests

2 participants