question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Static assets that are used as a background in css emit a warning

See original GitHub issue

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 image

Steps involved to reproduce the problem

  1. Create a frontity repository: npx frontity create
  2. Add any image the theme package
  3. Import it on the component index
  4. Add it as a background of any html element

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:

  • @frontity/core: ^1.15.1 => 1.14.3 If i console.log the asset i get two different urls on the client and on the server:
  • Background URL on client: /static/images/image.jpg
  • Background URL on the server: __webpack_public_path__images/image.jpg

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

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:19 (8 by maintainers)

github_iconTop GitHub Comments

4reactions
orballocommented, May 30, 2022

@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 😆

2reactions
meaghanbasscommented, Sep 30, 2022

Is there any update on this?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why would the background-image property cause a warning ...
Answer :- Yes; background-image property is recognized by all browsers & the image is still shows in the website but the way we...
Read more >
background-image - CSS: Cascading Style Sheets | MDN
If the images cannot be loaded—for instance, when the network is down—the background color will be used as a fallback.
Read more >
css-loader | webpack - JS.ORG
Warning. To use css-loader, webpack@5 is required ... To import assets from a node_modules path (include resolve.modules ) and for alias , prefix...
Read more >
Configuration - Sphinx documentation
The full project version, used as the replacement for |release| and e.g. in the HTML ... exclude_patterns is also consulted when looking for...
Read more >
gatsby-background-image
The fluid or fixed props may be given as an array of images returned from fluid or fixed queries or CSS Strings like...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found