Currently, calling I18nJS.listen in a Rails context starts a listener and also immediately exports all files, no matter what.
This is causing an inconvenience in our project because it overwrites all exported JSON files even if absolutely nothing changed. The overwrite implies a change in mtime timestamp, which in turn is used by our Webpack dev server to assess whether or not it needs to recompile.
Briefly put, using I18nJS.listen makes our Webpack setup recompile upon on botting the server due to I18N assets, even when those assets haven't changed
Describe the solution
Have the listener determine whether or not it needs to write the file.
Description
Currently, calling
I18nJS.listen
in a Rails context starts a listener and also immediately exports all files, no matter what. This is causing an inconvenience in our project because it overwrites all exported JSON files even if absolutely nothing changed. The overwrite implies a change inmtime
timestamp, which in turn is used by our Webpack dev server to assess whether or not it needs to recompile.Briefly put, using
I18nJS.listen
makes our Webpack setup recompile upon on botting the server due to I18N assets, even when those assets haven't changedDescribe the solution
Have the listener determine whether or not it needs to write the file.
Alternatives you considered
None.
Additional context
The relevant section of the code I believe is https://github.com/fnando/i18n-js/blob/main/lib/i18n-js/listen.rb#L29-L30 It always invokes
I18nJS.call
after setting up the listener, without determining changes.