摘要: 1. 设置webpack为开发模式 设置模式(mode: development/production) 设置source maps (devtool: 'inline-source-map') const path = require('path'); const HtmlWebpackPlugi 阅读全文
posted @ 2022-11-22 17:43 箫笛 阅读(73) 评论(0) 推荐(0)
摘要: 一旦在文件名中使用哈希并输出多个包时,将很难继续手动管理index.html文件, 但是一些插件可以使这个过程更易于管理。 1. 手动管理输出 webpack.config.js const path = require('path'); module.exports = { entry: './s 阅读全文
posted @ 2022-11-22 17:41 箫笛 阅读(34) 评论(0) 推荐(0)
摘要: 1. 准备配置文件 dist/index.html <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title>Asset Management</title> </head> <body> <script src="bundle.js 阅读全文
posted @ 2022-11-22 11:38 箫笛 阅读(25) 评论(0) 推荐(0)
摘要: webpack的核心是现代javascript 应用程序的静态模块打包器。当webpack处理你的应用程序时, 它会在内部从一个或多个入口点构建一个依赖关系图,然后将你的项目需要的每个模块组合到一个 或多个包中,这些包是静态资产,可以为你的内容提供服务。 1. 安装webpack 创建项目目录,初始 阅读全文
posted @ 2022-11-22 11:36 箫笛 阅读(96) 评论(0) 推荐(0)