当前位置:网站首页>5. 自动引入打包资源 plugins的使用
5. 自动引入打包资源 plugins的使用
2022-08-06 08:01:00 【Rick_Jci】
html-webpack-plugin
1. 作用
- 基于模板html文件生成一个html文件,自动引入webpack打包生成的js文件
2. 安装
npm install html-webpack-plugin -D
3. 引入和配置
// webpack.config.js
// 引入
const HtmlWebpackPlugin = require('html-webpack-plugin')
// 使用
new HtmlWebpackPlugin({
template: path.join(__dirname, './index.html'), // 模板文件目录(相对路径也可以)
filename: 'webpack.html', // 生成的html文件的名字
inject: 'body' // webpack打包生成的js文件插入的位置(默认插入head标签)
})
4. 重新打包webpack
npx webpack
边栏推荐
- unity 使用paint in 3d实现画板效果
- C语言 结构体
- 猴子都会用的Unity路径移动工具
- [Cloud Native--Kubernetes] Configuration Management
- BuuWeb
- 使用Specification与Example方式实现动态条件查询案例
- How to limit command length to bounce shell
- R语言常用数据处理代码整理
- 猴子都会用的UNITY圆形滑动自动吸附UI工具
- Original Questions for Level 5 of China Electronics Society Youth Grade Examination
猜你喜欢

LeetCode——1047. 删除字符串中的所有相邻重复项

使用Specification与Example方式实现动态条件查询案例

测试用例设计方法-场景法详解

【基于simulink的二阶电路仿真】

Test case design method - detailed explanation of scenario method

CSDN official plug-in

在Windows上安装Go语言开发包

Day020 Method Overriding and Polymorphism

Rock vocal | completes the safety operation, is not so difficult as you think

Check the inverse relationship between the shift distance and the number of iterations
随机推荐
亿纬首件大圆柱电池系统产品成功下线
commonJs和es6的区别
CSDN official plug-in
ggplot2绘制经济学风格的图形
Jetpack WorkManager 看这一篇就够了~
【leetcode】8. 字符串转换整数 (atoi)
Android 应用安全机制实现方案探究
明日立秋 autumn begins,天气渐凉
【基于simulink的二阶电路仿真】
qwqのtechnology flag
禁止运行游戏的程序开发
UNIX环境高级编程-第二章
typescript变量
JMeter集合点
The origin of the name, concave language -, and moral
Day020 方法重写与多态
dalle2:hierarchical text-conditional image generation with clip
EsgynDB Troubleshooting - nic MTU lead to the failure across a network segment to access the database
[Popular Science] What basic knowledge do I need to learn to engage in Web3?
验算移位距离和与迭代次数的反比关系