铃儿响叮当
铃儿响叮当
  • 发布:2024-03-26 15:33
  • 更新:2024-03-26 17:35
  • 阅读:1078

WARNING: asset size limit: The following asset(s) exceed the recommended size limit (244 KiB)

分类:uni-app

uni-app发行H5包时出现如下警告信息:
[HBuilder] 15:07:45.313 WARNING: asset size limit: The following asset(s) exceed the recommended size limit (244 KiB).
[HBuilder] 15:07:45.313 This can impact web performance.
[HBuilder] 15:07:45.318 Assets:

2024-03-26 15:33 负责人:无 分享
已邀请:
JXWang

JXWang

资源(asset)和入口起点超过指定文件限制,需要在 vue.config.js 文件内做如下配置:

module.exports = {  
    //webpack配置  
    configureWebpack: {  
        //关闭 webpack 的性能提示  
        performance: {  
            hints:false  
        }  

        //或者  

        //警告 webpack 的性能提示  
        performance: {  
            hints:'warning',  
            //入口起点的最大体积  
            maxEntrypointSize: 50000000,  
            //生成文件的最大体积  
            maxAssetSize: 30000000,  
            //只给出 js 文件的性能提示  
            assetFilter: function(assetFilename) {  
                return assetFilename.endsWith('.js');  
            }  
        }  
    }  
}

参考文章

  • 铃儿响叮当 (作者)

    vue.config.js这个文件在uni-app项目中应该放在哪?和manifest.json这个文件同级吗?

    2024-03-27 09:44

  • JXWang

    回复 铃儿响叮当: 是的,可参考这个文档:https://uniapp.dcloud.net.cn/collocation/vue-config.html

    2024-03-27 10:14

  • 铃儿响叮当 (作者)

    回复 JXWang: 好的。感谢!

    2024-03-27 10:16

要回复问题请先登录注册