在webpage中会需要对img进行处理,比如说在css或者less中引入
html {
padding: 0;
margin: 0;
background-color: pink;
}
#d1 {
width: 300px;
height: 300px;
background-image: url(./img/1.jpg);
}
此时我们只需要在webpack.config.js中进行如下操作即可
const {
resolve } = require("path");
const HtmlWebpackPlugin = require("html-webpack-plugin")
module.exports = {
entry: "./src/index.js",
output: {
path: resolve(__dirname, "build"),
filename: "js/build.js",
},
module