2022-01-24

To understand the regular expression used in Webpack's SplitChunksPlugins CacheGroup [duplicate]

I'm trying to migrate Webpack 3 to Webpack 4 which forces us to use Split Chunks Plugin.

Split Chunks Plugin uses cacheGroups object as a way to group the chunks together. In any of those cache groups, there is a test property which says

vendors: {
  test: /[\\/]node_modules[\\/]/,
  priority: -10
}

My question is what is [\\/] in the regular expression. I know forward slashes should be escaped because they are regular expression's reserved characters but IMO, it should be

vendors: {
  test: /\/node_modules\//,
  priority: -10
}

Can anyone please explain the difference?



from Recent Questions - Stack Overflow https://ift.tt/3tNaJmS
https://ift.tt/eA8V8J

No comments:

Post a Comment