I've below directory structure for my react app.
src
assets
dummy.svg
scss
dummy.scss
js
dummy.js
Below is the standard build format generated in CRA.
build
static
js
hashed-js.js
css
hashed-css.css
media
hashed-image.svg
I've specified a svg in my scss as background-image: url("../assets/dummy.svg")
If PUBLIC_URL is specified, CSS generated will have image path relative to PUBLIC_URL like
background-image: url(PUBLIC_URL/static/media/hashed-image.svg)
Is there a way or does react-scripts/webpack provides some configuration to have some other variable injected rather than PUBLIC_URL?
Something like background-image: url(REACT_SOME_OTHER_VARIABLE/static/media/hashed-image.svg)