0

I just upgraded to Webpack 5 and noticed that the splitChunks are not working as they were before. Here is my code

splitChunks: {
  chunks: 'all',
  maxInitialRequests: Infinity,
  cacheGroups: {
    common: {
      test: /[\\/]node_modules[\\/](@common)[\\/]/,
      name: 'common',
      ...chunksGroupOptions
    },
    vendor: {
      test: /[\\/]node_modules[\\/](!@common)[\\/]/,
      name: 'vendors',
      ...chunksGroupOptions
    }
  }
}

The portion that no longer works is vendors. How can I get all node_modules that are not in th "@common" directory to be bundled together ? This exact snippet worked fine in Webpack 4.

Komakino_1251
  • 220
  • 2
  • 13

1 Answers1

0

I think your vendor regular expression doesn't quite work the way you need it to.

It should look like this: /[\\/]node_modules[\\/](?!@common).+[\\/]/

If this didn't help could you write how exactly it doesn't work?