浅析webpack-bundle-analyzer在vue-cli3中的使用
作者:ypeusksk 时间:2024-05-28 16:09:50
正常的使用方法
安装
npm install webpack-bundle-analyzer -D
webpack.config.js:
vue-cli3的配置方法
根目录的vue.config.js(没有则自己创建)
module.exports = {
chainWebpack: config => {
config
.plugin('webpack-bundle-analyzer')
.use(require('webpack-bundle-analyzer').BundleAnalyzerPlugin)
}
}
执行以下命令即可查看到结果。
npm run serve
也可以改为独立的script
vue.config.js
module.exports = {
chainWebpack: config => {
if (process.env.use_analyzer) {
config
.plugin('webpack-bundle-analyzer')
.use(require('webpack-bundle-analyzer').BundleAnalyzerPlugin)
}
}
}
package.json
{
"scripts": {
...
"analyzer": "use_analyzer=true npm run serve"
}
}
那么在使用以下命令时,才会弹出analyzer
npm run analyzer
总结
以上所述是小编给大家介绍的webpack-bundle-analyzer在vue-cli3中的使用,网站的支持!
如果你觉得本文对你有帮助,欢迎转载,烦请注明出处,谢谢!
来源:https://blog.csdn.net/ypeusksk/article/details/88192385
标签:vue,cli3,webpack,bundle,analyzer
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
PHP基于phpqrcode类生成二维码的方法详解
2023-06-12 17:20:38
![](https://img.aspxhome.com/file/2023/0/55310_0s.png)
python+Word2Vec实现中文聊天机器人的示例代码
2023-08-04 13:11:29
在ASP.NET 2.0中操作数据之六十八:为DataTable添加额外的列
2024-05-09 09:03:27
![](https://img.aspxhome.com/file/2023/3/129813_0s.png)
Django利用LogEntry生成历史操作实战记录
2021-10-23 04:23:58
![](https://img.aspxhome.com/file/2023/4/99314_0s.png)
python正则表达式用法超详细讲解大全
2023-09-13 03:27:07
python将天气预报可视化
2021-01-19 01:37:46
![](https://img.aspxhome.com/file/2023/5/110495_0s.jpg)
javascript浮点数计算的bug
2009-12-06 11:43:00
无图片CSS圆角的五个实例
2008-08-02 12:18:00
![](https://img.aspxhome.com/file/UploadPic/20088/2/200882123118382s.jpg)
python开发实时可视化仪表盘的示例
2022-04-23 15:33:44
![](https://img.aspxhome.com/file/2023/0/112370_0s.gif)
Java连接MySQL数据库增删改查的通用方法(推荐)
2024-01-22 12:00:36
python语法学习print中f-string用法示例
2021-01-08 11:11:24
如何处理Python3.4 使用pymssql 乱码问题
2021-07-02 12:01:11
Python多模块引用由此引发的相对路径混乱问题
2021-07-11 03:57:10
![](https://img.aspxhome.com/file/2023/8/124388_0s.png)
MySQL 不等于的三种使用及区别
2024-01-28 20:03:56
![](https://img.aspxhome.com/file/2023/9/105219_0s.png)
anaconda3安装及jupyter环境配置全教程
2021-03-26 07:45:07
![](https://img.aspxhome.com/file/2023/3/82923_0s.png)
Python机器学习NLP自然语言处理Word2vec电影影评建模
2022-09-07 09:40:35
![](https://img.aspxhome.com/file/2023/5/112515_0s.gif)
详解Vue 全局引入bass.scss 处理方案
2024-06-05 10:03:08
运行asp.net程序 报错:磁盘空间不足
2011-11-03 17:16:22
SuperSocket 信息: (SpnRegister) : Error 1355。解决方法
2024-01-17 22:54:02
详解python基础中的for循环
2021-04-23 07:42:11
![](https://img.aspxhome.com/file/2023/8/88998_0s.png)