問題:(參考 https://webpack.docschina.org/configuration/performance)css
js中引入加密文件bcryptjs: import bcrypt from "bcryptjs";webpack
形成webpack報錯信息:web
WARNING in asset size limit: The following asset(s) exceed the recommended size limit (195 KiB).
This can impact web performance.
Assets:
user.js (354 KiB)app
WARNING in 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/ide
解決:函數
修改webpack配置信息,添加如下代碼:ui
performance: { hints: "warning", // 枚舉 maxAssetSize: 300000, // 整數類型(以字節爲單位) maxEntrypointSize: 500000, // 整數類型(以字節爲單位) assetFilter: function(assetFilename) { // 提供資源文件名的斷言函數 return assetFilename.endsWith('.css') || assetFilename.endsWith('.js'); } },
就是爲了加大文件容許體積,提高報錯門欄。加密
ok。spa