I've encountered an issue while trying to load a background image in my React project from a custom CSS file. I am currently using Webpack 4.
.bgimage {
height: 100vh;
background: url('../images/header.jpg');
}
Unfortunately, the image is not displaying and I'm receiving this error in the console:
ERROR in ./src/app/assets/images/header.jpg
Module build failed: SyntaxError: Unexpected character '' (1:0)
In an attempt to resolve this issue, I added url-loader to my webpack.config.js
{
test: /\.(png|jpg|gif)$/,
loader: "url-loader",
query: { mimetype: "image/png" }
}
Despite this addition, the image still refuses to show up on the page.