如何解決asset size limit: The following asset(s) exceed the recommended size limit (244 KiB).


今天運行vue項目 npm run build 時,終端webpack報錯:

打包報錯: 錯誤原因,資源(asset)和入口起點超過指定文件限制,

asset size limit: The following asset(s) exceed the recommended size limit (244 KiB). This can impact web performance.

 

 解決方法:

在vue.config.js增加配置:

 

 核心作用代碼如下:

    configureWebpack: config => {
        // 為生產環境修改配置...
        if (process.env.NODE_ENV === 'production') {
            config.mode = 'production';
            // 打包文件大小配置
            config.performance = {
              maxEntrypointSize: 10000000,
              maxAssetSize: 30000000
            }
        }
    },

  


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM