chunks

默认是 ['umi'],可修改,比如做了 vendors 依赖提取之后,会需要在 umi.js 之前加载 vendors.js

比如:

  1. export default {
  2. chunks: ['vendors', 'umi']
  3. chainWebpack: function (config, { webpack }) {
  4. config.merge({
  5. optimization: {
  6. minimize: true,
  7. splitChunks: {
  8. chunks: 'all',
  9. minSize: 30000,
  10. minChunks: 3,
  11. automaticNameDelimiter: '.',
  12. cacheGroups: {
  13. vendor: {
  14. name: 'vendors',
  15. test({ resource }) {
  16. return /[\\/]node_modules[\\/]/.test(resource);
  17. },
  18. priority: 10,
  19. },
  20. },
  21. },
  22. }
  23. });
  24. },
  25. }