On the problem of using style= "background-image: url ('xx.png') to introduce pictures in html files in webpack

in css files, you can directly use url-loader to solve
use picture tags in html you can use html-loader or html-withimg-loader to solve
but what is the solution to introduce pictures using element background in html? < div style= "background-image: url ("xx.png") > < / div >

Note: not react and vue projects, but traditional template page packaging
Jun.20,2022

with ejs-loader, you can write something like: <% require ("xxx.jpg")% >


can I add require?
url (require ('xx.png'))


set alise to @ in resolve in the webpack configuration, and then use url ("@ / assets/xxxxxx") in the project. Or you can use ~. This is currently used in
vue. Url ("~ @ / assets/xxxxxx")

Menu