user2024080
user2024080

Reputation: 5101

`angular` how to fix this warning `Emitted value instead of an instance of Error`

My angular CLI works fine. getting the images as well. But still, I am getting a warning like this:

WARNING in ./src/app/home/home.component.css
(Emitted value instead of an instance of Error) postcss-url: C:\Projects\dhl-testing\src\app\home\home.component.css:4:3: Can't read file 'C:\Projects\dhl-testing\src\app\home\assets\images\dhlmoped.jpg', ignoring

and

WARNING in ./node_modules/raw-loader!./node_modules/postcss-loader/lib??embedded!./src/styles.css
(Emitted value instead of an instance of Error) postcss-url: C:\Projects\dhl-testing\src\assets\css\sm\header.css:43:5: Can't read file 'C:\Projects\dhl-testing\src\assets\css\sm\assets\images\icon-user.png', ignoring

what are these warnings and how to fix them?

Upvotes: 15

Views: 24443

Answers (3)

test_124
test_124

Reputation: 1403

Add '/' to the beginning of the path: example:'/assets/images/logo.png' where assets is located in the root under src Folder

Upvotes: 24

Eddie Maas
Eddie Maas

Reputation: 51

From the looks of it, you are using absolute CSS image paths

C:\Projects\dhl-testing\src\app\home\assets\images\dhlmoped.jpg

Make this relative, something like

url("\assets\images\dhlmoped.jpg")

Upvotes: -1

SrAxi
SrAxi

Reputation: 20005

In webpack.config.json, do the following change:

"exclude": [
      // instead of /\/node_modules\//
      path.join(process.cwd(), 'node_modules')
    ]

That regex is not working properly for some reason.

(At least, this was my issue...)

Upvotes: 0

Related Questions