-
-
Notifications
You must be signed in to change notification settings - Fork 50
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
Cannot read property 'spritemap': after update to v4.0 #163
Comments
For some reason I can't seem to reproduce this but the stacktrace helped a lot. Can you verify the fix in c46f9eb resolves the issue for you? You can install this from GitHub directly:
|
Hi @cascornelissen, I am working on upgrading my project and face the same issue. I am using Here is my webpack configuration for SVGSpritemapPlugin: new SVGSpritemapPlugin('src/asset/vector/**/*.svg', {
output: {
filename: 'vector/sprite.svg',
svgo: {
floatPrecision: 2,
},
},
sprite: {
prefix: false,
generate: {
title: false,
},
},
}), |
If anyone can provide a repository that I can use to reproduce the issue, that'd help a lot. For some reason I can't seem to reproduce this on my system... @xavierfoucrier, using your configuration with version 4 of this plugin throws a bunch of errors because the SVGO configuration isn't supported by SVGO 2, see release notes for additional information. |
@cascornelissen Yes I saw that the configuration changed, I will upgrade it and let you know. I will investigate and drop a minimal reproductible test repository if needed 😉 |
@cascornelissen just to be sure, something like this works on your side? output: {
filename: 'vector/sprite.svg',
svgo: {
plugins: [{
name: 'cleanupNumericValues',
params: {
floatPrecision: 2,
},
}],
},
}, |
Yes, that works on my side when using the latest commit of
Then I do:
Which succeeds with the following output:
And a generated spritemap that seems to be correct:
|
@cascornelissen on my side it compiles fine for Another point, the Thanks! |
@cascornelissen I have just sent you an invite on a private sandbox repository!
Looks like the NPM Thanks for the feedback 😉 |
Hi @cascornelissen
maybe because of my output filename config :
|
other thing =>
my generate file scss :
[contenthash] is not replace or converted... (development mode) |
@xavierfoucrier, thanks for the repository, that helped a lot. It's indeed a problem that only pops up in watch mode. It should be fixed in ece1ea4. These fixes should also resolve the issue with the SVGO plugins not getting applied, using your example repository with @Diono, with regards to:
Can both of you try out these changes and report back?
|
@cascornelissen I will tomorrow! Thanks 💪 |
Hi @cascornelissen, Yes I can confirm it works fine 👍 Thanks a lot! |
it's not fine for me :/
actually, the file name is : www/dist/sprite.f0aaf566966dd040d07a.svg |
in development mode, its worst now... i have few errors now like this
|
@Diono, can you share a repository that I can use to reproduce/verify this? |
yes i did a small project of my config => https://github.com/Diono/test |
@xavierfoucrier, I've just published @Diono, thanks, I was hoping for a bit of a smaller repository, it's kind of hard figuring out what's happening when there's tens of additional plugins being loaded, there's CSS files getting generated containing JS, but I took a quick look...
If you can provide a minimal repository that explains this issue I can take another look. |
@cascornelissen thanks a lot! 😉 |
I try to debug my project. I guess when sass-loader read the generated scss file, the sprite.svg is not yet build in the webpack.output.publicPath. who's the first generated? the sprite svg or the scss file? |
OK i found the changes! |
In my sprite.scss i had |
That's the thing, it should still do that: svg-spritemap-webpack-plugin/lib/index.js Lines 284 to 292 in 31e7ace
I was trying to debug why it's not working in your project but there's so many irrelevant things going on in that repository that I can't figure it out easily. While I do enjoy fixing bugs, I don't enjoy spending hours trying to understand some more complicated codebase as much 😅 Which is why I asked for a minimal repository. You can also debug it yourself, you might get further because you know your codebase. You can just add |
yes i understood! |
Nice, that helps a lot. The error is thrown because That fixes the issue during the compilation but there might still be an issue where the path is incorrect when using the compiled code in the browser. I can't really find a way to verify this using your repository, if you're able to incorporate something like html-webpack-plugin to start a development server when executing |
I added html-webpack-plugin : https://github.com/Diono/test |
also i have a small warning about division in sass :
you should upgrade your generated sass file ;) |
Thanks again for the additional information, I'm pretty sure the fix in 7da9664 should resolve the path issue you're running into. The division symbol deprecation warning should be gone with the changes in 6296251. It's a little more complicated than simply upgrading the generated sass file, other processors such as libsass don't implement In the future, creating a separate issue for something totally unrelated is usually the way to go to keep discussions on track ✌🏼 If you could test both of these by installing directly from GitHub, that'd be great! ❤️
|
YEAAAAAAHHHHH its works!!! well done! great job :) ❤️ |
That's great to hear, I've just published |
Description
After update to v4.0 error: Cannot read property 'spritemap' of undefined
Expected behavior
Build without error
Actual behavior
System information
Minimal reproduction
Additional context
The text was updated successfully, but these errors were encountered: