You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- #55 Use progress-bar-webpack-plugin
- #76 Use webpack-chain and add `extendWithWebpackChain()` to modify Webpack config in an easier way.
- #77 Use HashedModuleIdsPlugin and ModuleConcatenationPlugin.
最近参考了一些文章和 Nuxt 等成熟方案,发现在 Lavas 使用 Webpack 构建的过程中,可能存在以下优化点:
在减少构建时间方面:
parallel
选项并行压缩 JS 代码。Nuxt 中也开启了这一选项。减少打包大小,提升执行速度:
ModuleConcatenationPlugin 可以:
另外,在 #38 中提到的打包方案的问题,现有的方案可能会存在问题:
使用 HashedModuleIdsPlugin 可以保证模块的 id 的稳定,从而保证 vendor.js 的 hash 不受到业务代码的影响。Nuxt 中在生产环境也使用了这个插件,而在开发环境使用了另一个 NamedModulesPlugin。这一点和 Webpack 文档中关于这两个插件的使用建议一致。
我会尝试一下以上方案,观察构建性能提升情况。
参考:
The text was updated successfully, but these errors were encountered: