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

Detecting webpack version via require-ing it works wrong in some tricky cases #338

Closed
andrey-skl opened this issue Jan 24, 2019 · 11 comments · Fixed by CollageLabs/collagelabs.org#127 · May be fixed by navikt/engangsstonad#715

Comments

@andrey-skl
Copy link
Contributor

It's a bug relates to #248.

Here svg-sprite-loader tries to detect webpack version by require-ing it:
https://github.com/kisenka/svg-sprite-loader/blob/master/lib/utils/get-webpack-version.js#L2

But this doesn't work if by some reason we have different webpack versions. I think it'd most reliable to analyze current webpack instance instead which loader is running on top.

@kisenka
Copy link
Contributor

kisenka commented Apr 27, 2019

Fixed in svg-sprite-loader@4.1.4

@kisenka kisenka closed this as completed Apr 27, 2019
@LoicUV
Copy link

LoicUV commented Jul 8, 2019

This change breaks gatsby-plugin-svg-sprite. It works until v4.1.3

Gatsby allows to override webpack config to add loaders such as this one. Although after your change in 4.1.4, the same line breaks with the error Error: Cannot find module 'webpack/package.json'

@DanielaValero
Copy link

Hello,

The same error Error: Cannot find module 'webpack/package.json' appears in VSCode with this plugin each time one opens a new js file. I had the version 4.1.6, downgrading to 4.1.3 made the error disappear.

@Nettsentrisk
Copy link

Getting the same error as @DanielaValero in VS Code while running ESLint with a webpack resolver.

@agigox
Copy link

agigox commented Oct 3, 2019

Hi @DanielaValero ,

Please how did you downgrade to 4.1.3, because I cannot find svg-sprite-loader in my package.json I have gatsby project

@Klutch27
Copy link

Klutch27 commented Feb 26, 2020

Same error as @DanielaValero . Currently using svg-sprite-loader 4.2.1.

@martinkadlec0
Copy link

Yup, the VS Code error unfortunately persist in 4.2.1 which includes #352.

@DanielaValero
Copy link

Actually that downgrading thing did not really work... I still have the problem, it has been so long that when is fixed I will miss the false negatives from the lintin notifications panel in VS Code, and the import statements...

@kisenka
Copy link
Contributor

kisenka commented Apr 12, 2020

@agigox @Klutch27 @martinkadlec0 @DanielaValero

Using autodetecting webpack version was very bad idea. I've published alpha version without detecting webpack version, could some of you guys help me with trying it out?

npm install svg-sprite-loader@drop-webpack-version-detector

TobiDimmel added a commit to TobiDimmel/angular-svg-sprite-issue that referenced this issue Apr 17, 2020
- use package svg-sprite-loader@drop-webpack-version-detector because of
JetBrains/svg-sprite-loader#338
@TobiDimmel
Copy link

@kisenka
I had this issue with my reproduction repo of #364, which is an Angular CLI project.
I tried your fixed version on a Windows machine and it worked with this repo.

@kisenka
Copy link
Contributor

kisenka commented Apr 26, 2020

Published svg-sprite-loader@4.2.6 without version detecting, but checking features instead.

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