merge-jsons-webpack-plugin icon indicating copy to clipboard operation
merge-jsons-webpack-plugin copied to clipboard

GroupBy pattern : files are not merged when a space exist in pattern

Open julienboulay opened this issue 4 years ago • 2 comments

I faced an issue regarding pattern, when a space exist in the pattern definition : These groupBy definitions will not work, because of the spaces, after the coma, or at the end of the pattern

groupBy: [
  {
      pattern: '{../../libs/sdk/src/resources/i18n/**/en.json, ./src/resources/i18n/**/en.json}',
      fileName: 'resources/i18n/en.json'
  }
]
groupBy: [
  {
      pattern: '{../../libs/sdk/src/resources/i18n/**/en.json,./src/resources/i18n/**/en.json }',
      fileName: 'resources/i18n/en.json'
  }
]

When writing the pattern, I felt as if it was a json object... when it's not. Is it possible to define the pattern as a string or an array of string, to avoid this kind of errors ?

groupBy: [
  {
      pattern: ['../../libs/sdk/src/resources/i18n/**/en.json', './src/resources/i18n/**/en.json'],
      fileName: 'resources/i18n/en.json'
  }
]

julienboulay avatar Jun 15 '20 09:06 julienboulay

@julienboulay , its handled by external package glob, it expects a string rather than an array of object. What I am planning to do is to sanitize the string (remove any spaces), do you think it makes sense? so that I dont break any existing code .

tettusud avatar Jun 15 '20 12:06 tettusud

Hi @tettusud,

First, thank you for this great plugin. Yes, it make sense to keep the current behaviour and sanitize the string. It may also be very interesting to display a log message if no file corresponding to pattern was found.

julienboulay avatar Jun 15 '20 20:06 julienboulay