-
-
Notifications
You must be signed in to change notification settings - Fork 603
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
Data URL as data:image/svg+xml is unable to be rendered after updating to 6.0.0 #1342
Comments
maybe relate with:#1337 |
for me not and I can not understand, how |
I've just removed that comment actually as I've found a small problem - so it's not 100% resolved, with regards to .png$, I also have more file extensions that are managed by this, svg jpg etc |
Digging into this issue a little deeper and comparing url-loader with asset modules the problem seems to be with the encoding of the generated data:image, in my case there is a # which if I change to %23 then the asset loads. |
Bug in decoding |
Fixed webpack/webpack#13807, let's wait release |
Thanks for the wicked fast turn around to resolution on this all! Looking
forward assisting with confirmation when I have a moment.
|
In the meantime if anyone needs an easy temporary fix, adding a filter to ignore any inline assets starting with {
loader: "css-loader",
options: {
url: {
// skip any data URLs of type image/svg+xml
filter: (url) => !(url.startsWith("data:image/svg+xml"))
}
}
} |
Fixed in webpack, please update webpack to the latest version https://github.com/webpack/webpack/releases/tag/v5.45.1 and remove workaround |
confirmed fixed after updating to 5.45.1 and removing my workaround above, thanks as always @alexander-akait 🙌 |
Has the issue reappeared with 5.46.0? SVGs stopped working as element background images on my css at least. |
No, double check webpack version, or provide example of the problem |
A generic solution to this problem for people still running into it (and will address url resolution being filtered for absolute paths) is to use const {isUrlRequest} = require('loader-utils');
{
loader: "css-loader",
options: {
url: {
// skip any data URLs or absolute paths
filter: url => isUrlRequest(url)
}
}
} This was taken from the default url filter for |
I faced this issue when updating from v5.66.0 to v5.67.0, dataUrls with inlined SVG's stopped working. CSS sourcecode:
Resulting code:
Webpack replaces the SVG by a JS template and emits an asset where it should not. |
@Roberto14 I think you have a problem with your configuration, can you provide a reproducible example and I will show you how to fix it |
After updating to 6.0.0 from 5.2.6 the default Bootstrap drop down arrow defined as an inline data:image/svg+xml URL no longer displays on screen.
Confirmed in Firefox 89.0.2 and Chrome 91.0.4472.114
Expected Behavior
We should be able to see the drop down arrow as given in the image below:
URL is modified in such a way that it is not able to render
This is an out of the box/untouched Bootstrap 5.0.2 rule as seen below as an image and the copied rule from bootstrap.css
Actual Behavior
After updating to 6.0.0 the arrow no longer renders as seen in the image below.
When using devtools in Firefox to examine the styles for the dropdown, it appears that some encoding has been applied to the data URL, making it unrenderable.
Code
Note: Bootstrap 5.0.2 is set up as a vendor module outside of package.json and therefore not included below.
How Do We Reproduce?
5.2.6 -> dropdown is visible
6.0.0 -> dropdown is not visible
The text was updated successfully, but these errors were encountered: