shellscape / webpack-manifest-plugin

webpack plugin for generating asset manifests
MIT License
1.44k stars 184 forks source link

Background-image path map can't be generated in manifest.json #189

Closed roadwild closed 4 years ago

roadwild commented 5 years ago

Hi!

I have created a repo to reproduce the problem, address is https://github.com/sinkinlife/webpack-demo/tree/master

issues description: I introduced multiple images in the vue component through background, but found that the manifest.json generated by webpack-manifest-plugin only has a mapping of the first image of each vue component

mycode: .icon { &.terrible { background: url('../../images/icon_zaogaob.png') no-repeat; } &.worse { background: url('../../images/icon_jiaochab.png') no-repeat; } &.general { background: url('../../images/icon_yibanb.png') no-repeat; } &.satisfaction { background: url('../../images/icon_manyib.png') no-repeat; } &.well { background: url('../../images/icon_chaozanb.png') no-repeat; } } .delete { background: url('../../images/delete.png') no-repeat; } .add { background: url('../../images/camera.png') no-repeat; }

manifest.json { "app.js": "scripts/app.93f159d46b2ced4eb0a5.js", "styles/1.282556c48ba0a1f16230.css": "styles/1.282556c48ba0a1f16230.css", "scripts/1.b3859898404b7e35f17f.js": "scripts/1.b3859898404b7e35f17f.js", "assets/appraise/js/images/index.vue?vue&type=style&index=0&id=9ec7926a&lang=scss&scoped=true&": "assets/appraise/js/images/delete.cafa4d9efe6e8187e0ea71cc70eed8ba.png", "assets/appraise/js/images/index.vue?vue&type=style&index=0&id=4dcb8fd0&lang=scss&scoped=true&": "assets/appraise/js/images/icon_zaogaob.a6842408db5bc90215366ea6d88fe086.png" }

Some things I found:

  1. After removing the mini-css-extract-plugin, all images are mapped in manifest.json

Do you know why this happens?

huzhongchun commented 5 years ago

I have same problem! @mastilver

roadwild commented 5 years ago

I have same problem! @mastilver

Try to rewrite generate function to solve your problem

shellscape commented 4 years ago

This is related to the problem described in #167 and should be resolved once that's fixed.