Skip to content

QUESTION: route based package chunking #4

@ahmetkuslular

Description

@ahmetkuslular

hi,

The project is great, and I want to thank you first.

I'm working on a performance-focused project, and I want to chunk and separate route-based packages.

vendor: {
          test: /[\\/]node_modules[\\/]/,
          enforce: true,
          chunks: 'all',
          name(module: any) {
            const packageName = module.context.match(/[\\/]node_modules[\\/](.*?)([\\/]|$)/)[1];

            switch (packageName) {
              case 'react':
              case 'react-dom':
              case 'scheduler':
              case 'object-assign':
                return 'react';
              case 'path-to-regexp':
              case 'uuid':
                return 'rarely';
              default:
                return 'vendor';
            }
          },
        },

I want to separate them like the structure here, such as homeVendor, usersVendor, etc., and load only that vendor on the relevant page. Separating them is not a problem, but how can I decide which vendor to load on which route? Is it possible to do something like this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions