taro-包体积过大-webpack打包

待解决:——————

报错

 Warnings: 

AssetsOverSizeLimitWarning: asset size limit: The following asset(s) exceed the recommended size limit (244 KiB).
This can impact web performance.
Assets: 
  vendors.js (254 KiB)
    at Generator.next (<anonymous>)

NoAsyncChunksWarning: webpack performance recommendations: 
You can limit the size of your bundles by using import() or require.ensure to lazy load some parts of your application.
For more info visit https://webpack.js.org/guides/code-splitting/
    at Generator.next (<anonymous>)

根据提示文件 vendors.js ,https://juejin.cn/post/7046782284107612174#%E9%A1%B9%E7%9B%AE%E5%88%86%E6%9E%90

减小体积方法;
1.taro官方通过编译减少体积的方法都试了一遍,并没有什么用(生气😠)
https://docs.taro.zone/docs/guide#%E6%89%93%E5%8C%85%E4%BD%93%E7%A7%AF

其他尝试:
1.优化编译速度
https://docs.taro.zone/en/docs/compile-optimized/

2.可视化webpack文件大小插件

npm install webpack-bundle-analyzer --save-dev
//webpack中配置
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
 
module.exports = {
  plugins: [
    new BundleAnalyzerPlugin()
  ]
}

dist: "webpack -p"
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容