此懒加载是js文件的懒加载,不是图片资源的懒加载
这里的webpack配置很简单,需要单入口形式的
const path = require("path");
const HtmlWebpackPlugin = require("html-webpack-plugin"); //html模板
module.exports = {
mode: "production", //生产模式
entry: "./src/js/index.js",//单入口
output: {
filename: "js/[name].[contenthash:10].js",
path: path.