Reputation: 2210
I'm trying to access an asset to use in a css declaration...
import FooterBackgroundDesktop from "../../assets/register-bg.png";
"background-image": `url(${FooterBackgroundDesktop})`
However, although the path to assets and the filename is correct, I get the following error:
Cannot find module '../../assets/register-bg.png' or its corresponding type declarations.ts(2307)
Any ideas?
Upvotes: 1
Views: 484
Reputation: 1
use like this
"background-image": url("../../assets/register-bg.png")
or you can do this
let FooterBackgroundDesktop = "../../assets/register-bg.png";
"background-image": url(FooterBackgroundDesktop)
Upvotes: 1