nystudio107 / annotated-webpack-config

This is the companion github repo for the "An Annotated webpack 4 Config for Frontend Web Development" article.
https://nystudio107.com/blog/an-annotated-webpack-4-config-for-frontend-web-development
MIT License
436 stars 75 forks source link

How to load image assets into webpack-dev-server? #24

Open ilicmarko opened 4 years ago

ilicmarko commented 4 years ago

Referencing this issue https://github.com/nystudio107/craft/issues/27 here

Hi! I nearly got this working. Even with a webpack-dev-server with https and certificate stuff, but then I walked into a problem with hot module reloading and "background-image: url(/img/header1.jpg)" in homepage.pcss.

I cannot get these ones to work: url(/dist/img/header1.jpg) url(/img/header1.jpg) url(../img/header1.jpg) url(../../img/header1.jpg) url(/src/img/header1.jpg)

I peeked here to see if I could get an example of a local image in pcss, but they a pointed towards an cloudfront url: https://github.com/nystudio107/devmode/blob/master/src/css/components/global.pcss

Do you have a solution for this to get it right?

Thanks, Tim