Vue项目通过CDN优化ElementUI的打包

  1. main-prod.js中,注释掉element-ui按需加载的代码
  2. index.html的头部区域中,通过 CDN 加载element-ui的 js 和 css 样式:
<!-- element-ui 的样式表文件 -->
<link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css" />
<!-- element-ui 的 js 文件 -->
<script src="https://cdn.staticfile.org/element-ui/2.8.2/index.js"></script>

猜你喜欢

转载自blog.csdn.net/Jack_lzx/article/details/113977714