-
Notifications
You must be signed in to change notification settings - Fork 254
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
Static assets that are used as a background in css emit a warning #913
Comments
Interesting.
It is related to this PR, where we started populating the dynamic public path with The problem is that setting the correct public path dynamically at request time seemed not possible. I guess we need to find a way to do it. If anyone has experience doing this or wants to give it a try, please do so 🙂 |
Dropping this here because the previous solutions do not work. EDIT: This comment says it works: https://stackoverflow.com/a/58222901. I'll try this next week. |
@luisherranz I tried the plugin mentioned in my previous comment but once it is added to the No idea why this is happening. I don't know if the option |
What about the things I mentioned in #913 (comment)? Didn't they work? |
@luisherranz Nop they didn't. It looks like webpack needs the variable set at the entry point, before everything else, so changing the variable inside a function has no effect :/ |
I see. I'll try to test |
@orballo you're going to look into this, right? |
@luisherranz that is correct :) |
@luisherranz Apparently the plugin works well with chunks, but not with other assets. There is an issue open on that: agoldis/webpack-require-from#8 Is there a way to manipulate the emotion compiled string before sending it to the client? |
I'm not sure how to proceed, to be honest. I've been taking a look myself, but I couldn't find any solution to changing those values at runtime. The variables are there, but changing them doesn't seem to affect the output. |
@luisherranz I think we can get rid of this issue preprocessing the CSS. If we change the way we SSR the styles, like explained here, and we use |
That sounds promising 🙂 |
The last solution I proposed doesn't work either. Classes are generated with the styles string before being preprocessed in the cache, so even if it is replaced in the cache, it still triggers the warning. EDIT: I made it work with a huuuuge hack that I need to test in more scenarios to see if it works. |
Frontity v2 and switch to Vite? 😄 I don't know, to be honest. My only idea is to debug the final Does |
@luisherranz I don't know, but we are updating to Webpack 5 after the WordCamp because we are running already into some conflicts with other packages. So, I'll try after that. Frontity v2 sounds good, but I have a lot on my plate right now 😆 |
Hi guys! |
Hi @SergiusNahnoinyi! I'm afraid I couldn't figure out a fix. I was going to try with the You could give it a try, but I think it is a very long shot. Just in case you want to try, there is a beta branch of Frontity with webpack updated to v5. #925 (comment) |
Is there any update on this? |
Bug report
Expected behavior
Correctly styled rendering on the server side without any warnings when you add a static url from the server assets to the css props (like a background image)
Observed behavior
If you import an image and you add it as a background-image via css or style props, the console shows a warning,
Screenshots
Steps involved to reproduce the problem
I have created a repository with a hyper-simplified version of frontity where there is only a div with a static image as background: https://github.com/husseincak/testing/
Info about the problem
If you downgrade the package @frontity/core to the v 1.14.3, the warning no longer appears:
If i console.log the asset i get two different urls on the client and on the server:
Maybe the problem is because the two urls are diferent so the component is being rendered as a different component on the server and on the client
The text was updated successfully, but these errors were encountered: