merge-jsons-webpack-plugin
merge-jsons-webpack-plugin copied to clipboard
Watch is not picking up new files after dev-server started
Hi, I'm working on an Angular application and using the plugin to merge i18n files. It's working great however I've noticed that if I start a dev server ng serve it will detect changes on existing files and re compile but If I add a new json file I have to stop the dev server and re-start it for webpack to watch the new file.
I'm guessing it has something to do with the fact that when a new .json file is created it's blank and that would error out the plugin.
Thanks in advanced.
Dependencies: "@angular-builders/custom-webpack": "^9.2.0", "@angular-devkit/architect": ">= 0.900 < 0.1100", "@angular-devkit/build-angular": "~0.901.1", "merge-jsons-webpack-plugin": "^1.0.21",
custom-webpack.config.ts
import * as webpack from 'webpack';
import * as MergeJsons from 'merge-jsons-webpack-plugin';
const LANGUAGES = [
'english',
'español'
];
export default {
plugins: [
new MergeJsons({
debug: true,
output: {
groupBy: LANGUAGES.map((language: string) => {
return {
pattern: `./src/app/**/${ language }.json`,
fileName: `./assets/i18n/${ language }.json`
};
})
},
globOptions: {
nosort: true
}
})
]
} as webpack.Configuration;
@eruecco87 new version 2.0.0-alpha is published, it should fix the issue, however it has some breaking changes in case of arrays, please refer to read me.