Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

183
Views
Can`t resolve image.png in styles.css

Webpack cant build the project, because cant resolve image.

Project structure

project/
├─ node_modules/
├─ src/
│  ├─ assets/
│  │  ├─ images/
│  │  ├─ styles/
├─ package.json
├─ webpack.config.js

Here is webpack.config.js

{
  test: /\.(JPG|gif|svg|gif|png)(\?v=[0-9]\.[0-9]\.[0-9])?$/,
  type: 'asset/resource',
  generator: {
    filename: 'assets/images/[name].[contenthash:7][ext]'
  },
  use: [{loader: 'url-loader'}]
},

and main.css

.b-promo {
  background: url(../assets/images/bg.png) top no-repeat;
  background-size: cover
}

Error message

ERROR in ./assets/css/main.css
Module build failed (from ../node_modules/mini-css-extract-plugin/dist/loader.js):
ModuleBuildError: Module build failed (from ../node_modules/css-loader/dist/cjs.js):
Error: Can't resolve '../assets/images/bg.png' in '/home/path/to/project/src/assets/css'
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Seems like url() should take a string as a parameter see here

So try in main.css (and make sure that the relative path to bg.png file from main.css one is correct):

.b-promo {
  background: url("../assets/images/bg.png") top no-repeat;
  background-size: cover;
}

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!