Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
906 views
in Technique[技术] by (71.8m points)

vue-cli 打包组件上传到npm排除不必要的库?

网上的一些教程都过时了,不过我还是找到了一份:
https://www.cnblogs.com/wisew...
按照操作提交成功了,可是打出的包很大,而且依赖了一些不需要的库,比如axios,如下图:
0.png
这个axios是测试页面用到的,组件应该是不需要的,请问,如何正确的发布?

项目源码:https://gitee.com/ZeronoFreya...


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

不需要依赖axios就改为dev Dependencies

package.json 可指定 files 目录 or 新建.npmignore 只发布部分文件 https://docs.npmjs.com/files/...


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...