JetBrains / svg-sprite-loader

Webpack loader for creating SVG sprites.
MIT License
2.01k stars 272 forks source link

webpack should be a peer dependency #450

Open Eli-Black-Work opened 3 years ago

Eli-Black-Work commented 3 years ago

svg-sprite-loader uses webpack but doesn't declare it as a peer dependency, which generates warnings when using the Yarn Berry's PnP (plug and play) feature:

Error: svg-sprite-loader tried to access webpack, but it isn't declared in its dependencies; this makes the require call ambiguous and unsound.

To fix this problem, I believe svg-sprite-loader should list webpack in its peerDependencies or optionalDependencies section.

Eli-Black-Work commented 3 years ago

As a temporary workaround, it's possible to add this to one's .yarnrc.yml file:

# svg-sprite-loader depends on webpack but doesn't yet list it as a peer dependency.
#
# This gives us an error while compiling, so we patch svg-sprite-loader to add webpack as a peerDependency.
#
# Bug report: https://github.com/JetBrains/svg-sprite-loader/issues/450
packageExtensions:
    svg-sprite-loader@*:
        peerDependencies:
            "webpack": "*"
zhibin2015 commented 2 years ago

Has it been solved?

Eli-Black-Work commented 2 years ago

@zhibin2015 For a workaround, see the comment directly above yours 🙂